r/codegolf • u/binarycat64 • 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)}
6
Upvotes
r/codegolf • u/binarycat64 • Oct 16 '20
s=[n=2];ARGV[0].to_i.times{n+=1until s.all?{|m|n%m>0};s<<p(n)}
View all comments
Show parent comment
1
u/binarycat64 Oct 16 '20
I'm not convinced that it would actually speed it up, assuming you are working with fixed-size integers. I think you should be checking small numbers first anyway, but what do I know.