scripts/ege/СтатГрад № 5 Файлы/16.py
2023-05-05 00:45:01 +03:00

27 lines
328 B
Python
Vendored

fs = {}
def f(n):
if f in fs:
return fs[f]
if n > 1000000:
return n
k = n + f(2 * n)
fs[f] = k
return k
def g(n):
return f(n) / n
for i in range(1000000, 1, -1):
f(i)
c = 0
for i in range(1, 100000):
if g(i) == g(1000):
print(i)
print(c)