Skip to content

Instantly share code, notes, and snippets.

@magical
Created February 8, 2018 07:12
Show Gist options
  • Save magical/5055e26490c091fbdbff0f25b1c11233 to your computer and use it in GitHub Desktop.
Save magical/5055e26490c091fbdbff0f25b1c11233 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
N = 99999
a = [1,1] + [0]*N
i = 1
j = 0
while i < N:
if i == j:
print(i)
if j > N:
j = 0
elif j >= i:
a[j] = 1
j += i
elif a[i]:
i += 1
else:
j = i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment