mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-22 11:56:33 +03:00
22 lines
472 B
Python
Vendored
22 lines
472 B
Python
Vendored
def f(x, y, p):
|
|
if x + y >= 59 or p > 5:
|
|
return p in [3, 5]
|
|
if p % 2 == 1:
|
|
return (
|
|
f(x + 2, y, p + 1)
|
|
or f(x * 3, y, p + 1)
|
|
or f(x, y + 2, p + 1)
|
|
or f(x, y * 3, p + 1)
|
|
)
|
|
return (
|
|
f(x + 2, y, p + 1)
|
|
and f(x * 3, y, p + 1)
|
|
and f(x, y + 2, p + 1)
|
|
and f(x, y * 3, p + 1)
|
|
)
|
|
|
|
|
|
for s in range(1, 54):
|
|
if f(5, s, 1):
|
|
print(s)
|