2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,3 +1,4 @@
|
|||
fib 0 = 0 -- this line is necessary because "something ^ 0" returns "fromInteger 1", which unfortunately
|
||||
-- in our case is not our multiplicative identity (the identity matrix) but just a 1x1 matrix of 1
|
||||
fib n = last $ head $ unMat $ (Mat [[1,1],[1,0]]) ^ n
|
||||
fib n = go n 0 1
|
||||
where
|
||||
go n a b | n==0 = a
|
||||
| otherwise = go (n-1) b (a+b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue