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
  • Select an option

  • Save Graystripe17/745aa5e84a3083de6bcef70ed72b2dab to your computer and use it in GitHub Desktop.

Select an option

Save Graystripe17/745aa5e84a3083de6bcef70ed72b2dab to your computer and use it in GitHub Desktop.

Revisions

  1. Graystripe17 revised this gist Mar 26, 2017. 1 changed file with 15 additions and 11 deletions.
    26 changes: 15 additions & 11 deletions erdos-woods.py
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,19 @@
    from fractions import gcd

    k = 16
    k = 0
    a = 0

    UPPER_CHECK = 10000
    while True:
    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
    break
    a += 1
    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
  2. @Hainish Hainish created this gist Sep 15, 2016.
    15 changes: 15 additions & 0 deletions erdos-woods.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    from fractions import gcd

    k = 16
    a = 0

    while True:
    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
    break
    a += 1