Last active
December 14, 2015 19:29
-
-
Save mebubo/5136801 to your computer and use it in GitHub Desktop.
человек кладет сумму Х на депозит под 10% годовых на 30 лет. и каждый год добавляет туда еще Х. сколько будет через 30 лет? пусть f(n) кол-во денег через n лет
f(0) = x
f(n) = 1.1*f(n-1) + x (для n>0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| def f(n, x, coeff=0.1): | |
| if n == 0: | |
| return x | |
| else: | |
| return (1 + coeff) * f(n - 1, x, coeff) + x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment