project-euler/129_repunit_divisibility.py

19 lines
265 B
Python
Raw Normal View History

2023-03-26 17:21:44 +02:00
#!/usr/bin/env python3
def minrep(n):
base = 10 % (9*n)
m = base
c = 1
while m != 1:
m = (m * base) % (9*n)
c += 1
return c
target = 10**6
n = target + (not target%2)
while n%5 == 0 or minrep(n) < target:
n += 2
print(n)