Haskell 斐波那契 数列 递归实现
haskell
let fibonacci n = if n < 3 then 1 else fibonacci (n-2) + fibonacci(n-1)
Prelude> fibonacci 20
6765
python
def factorial(n):
if n==1 or n==2:
return 1
else:
return factorial(n-1)+factorial(n-2)
#f=factorial(30)