Solve 133 and 134.
This commit is contained in:
23
python/e133.py
Normal file
23
python/e133.py
Normal 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
|
||||
Reference in New Issue
Block a user