Advertisement · 728 × 90
#
Hashtag
#paxtons_wheel
Advertisement · 728 × 90

Alternative #paxtons_wheel for #prime_numbers :

import sys

p = [0]*1000000
while (1):
print (1,2)
i=3
n=999000
while (i<=n):
j=i*3
if(p[i]==0):
print(i)
while(j<=n):
p[j]=1
j=j+1
i=i+2
exit(1)

When compiled, this is FAST!

0 0 0 1

More on #paxtons_wheel for #prime_numbers.

I was thinking that for the outer FOR loop, you only
have to test up to the square root of n. If you go any
higher, you're just repeating likewise calculations (ie.
5*19 = 19*5, etc.) This would save a large amount of
processing. This is integer math.

1 0 0 0