Moved problems till 56 to Python.

This commit is contained in:
2019-07-17 21:29:59 -04:00
parent 301033d17d
commit c624e6ac52
23 changed files with 417 additions and 23 deletions

View File

@@ -1,8 +1,22 @@
from lib_prime import is_prime
def euler_046():
return 0
n_max = 10000
twice_squares = [2 * n * n for n in range(1, n_max + 1)]
def test_conjecture(n):
for ts in twice_squares:
if ts > n:
return False
if is_prime(n - ts):
return True
for n in range(3, n_max + 1, 2):
if not is_prime(n) and test_conjecture(n) is False:
return n
if __name__ == "__main__":
print("e046.py: " + str(euler_046()))
assert(euler_046() == 0)
assert(euler_046() == 5777)