mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-15 01:16:36 +03:00
27 lines
328 B
Python
27 lines
328 B
Python
|
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)
|