r/codegolf • • Oct 16 '20

Prime numbers in 63 bytes of ruby

s=[n=2];ARGV[0].to_i.times{n+=1until s.all?{|m|n%m>0};s<<p(n)}

7 Upvotes

18 comments sorted by

View all comments

Show parent comment

1

u/binarycat64 Feb 24 '21

yeah, i didn't know about $* at the time.

2

u/Aspie_Astrologer Feb 24 '21

Yeah, finding global variables upped my Ruby code golf game a lot. Especially puts$<.map{...}

2

u/binarycat64 Mar 01 '21

yep, that's the one.