Solve 133 and 134.

This commit is contained in:
2024-04-25 19:01:38 -04:00
parent c3f24f445e
commit a0c906bd58
2 changed files with 63 additions and 0 deletions

23
python/e133.py Normal file
View File

@@ -0,0 +1,23 @@
from lib_prime import primes
def r_modulo_closed_form(n, m):
assert n > 0 and m > 0
return ((pow(10, n, 9 * m) - 1) // 9) % m
def euler_132():
n = 10**20
r = 0
for p in primes(100_000):
if r_modulo_closed_form(n, p) == 0:
pass
else:
r += p
return r
if __name__ == "__main__":
solution = euler_132()
print("e132.py: " + str(solution))
assert solution == 453647705