mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-08 03:00:37 +00:00
Add university content
This commit is contained in:
18
high-school/fibonacci/code1.py
Normal file
18
high-school/fibonacci/code1.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import numpy as np
|
||||
|
||||
|
||||
def fibobo(n):
|
||||
if n <= 1:
|
||||
return n
|
||||
return fibobo(n - 1) + fibobo(n - 2)
|
||||
|
||||
|
||||
print(fibobo(30))
|
||||
|
||||
|
||||
def fibibi(n):
|
||||
fibi = np.array([[1, 1], [1, 0]])
|
||||
return np.linalg.matrix_power(fibi, n)[0][-1]
|
||||
|
||||
|
||||
print(fibibi(100))
|
||||
Reference in New Issue
Block a user