21 lines
424 B
Python
21 lines
424 B
Python
def count(i, s, c, depth):
|
|
if depth == 0:
|
|
return s + i, c + 1
|
|
for i in range(i, i * 8, i):
|
|
s, c = count(i, s, c, depth - 1)
|
|
if c == 10**9:
|
|
break
|
|
return s, c
|
|
|
|
|
|
def euler_148():
|
|
s, c = count(1, 0, 0, 11)
|
|
assert c == 10**9
|
|
return s
|
|
|
|
|
|
if __name__ == "__main__":
|
|
solution = euler_148()
|
|
print("e148.py: " + str(solution))
|
|
assert solution == 2129970655314432
|