Solved 72 in Python.

This commit is contained in:
2019-08-01 18:28:53 -04:00
parent 8b1a4fa6ef
commit 4c93d34c26
3 changed files with 120 additions and 2 deletions

View File

@@ -29,6 +29,22 @@ def euler_071():
return n_min
def euler_071_farey():
"""
https://www.cut-the-knot.org/blue/Farey.shtml
n_min must be located between 2/5 and 3/7 for F_7
To calculate F_d where d <= 10**6 we continously calculate the
median between 3/7 and the new fraction.
"""
n, d = (3, 7)
n_D, d_D = (2, 5)
while d_D + d <= 10**6:
n_D = n_D + n
d_D = d_D + d
return n_D
if __name__ == "__main__":
print(euler_071_farey())
print("e071.py: " + str(euler_071()))
assert(euler_071() == 428570)