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 Oct 17 '20

I also just put that there for anyone else who wanted to figure it out.

another thing is only `p` returns it's input, the more common `puts` returns nil (`puts` doesn't print quotes around strings).