Skip to content

Instantly share code, notes, and snippets.

@Graystripe17
Forked from Hainish/erdos-woods.py
Last active March 26, 2017 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Graystripe17/745aa5e84a3083de6bcef70ed72b2dab to your computer and use it in GitHub Desktop.
Save Graystripe17/745aa5e84a3083de6bcef70ed72b2dab to your computer and use it in GitHub Desktop.
Proof that 16 is an Erdős-Woods number
from fractions import gcd
k = 0
a = 0
UPPER_CHECK = 10000
while True:
while a < UPPER_CHECK:
ew = True
for i in xrange(a+1, a+k):
if gcd(i, a) == 1 and gcd(i, a+k) == 1:
ew = False
if ew == True:
print "Erdos Number:", k
print "Proof:", a
a = 0
break
a += 1
a = 0
k += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment