mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-29 22:53:42 +03:00
10 lines
162 B
Python
10 lines
162 B
Python
|
def f(n):
|
||
|
if n < 3:
|
||
|
return 1
|
||
|
if n % 2 == 0:
|
||
|
return 2 * f(n - 1) - f(n - 2)
|
||
|
return f(n - 1) - 2 * f(n - 2) - 3
|
||
|
|
||
|
|
||
|
print(f(15))
|