Skip to main content
2 of 2
Changing 1 million to 999984 to save a byte
Vasu Adari
  • 979
  • 7
  • 17

Ruby, 118 117 bytes

n=999984;t=true;a=[t]*n;(2..Math.sqrt(n).round).each{|i|a[i]&&(i..n/i).each{|j|a[j*i]=!t}};(2..n).each{|i|a[i]&&p(i)}

Run Time:

0.53s user 0.13s system 92% cpu 0.714 total
Vasu Adari
  • 979
  • 7
  • 17