Skip to content

Instantly share code, notes, and snippets.

@ErikBjare
ErikBjare / fib.hs
Created September 28, 2013 15:50
My first Haskell function, calculates the fibonacci sequence.
-- Takes an empty list *l* and calculates a *n* numbers in the fibonacci sequence
fib l n
| l == [] = fib [1,1] n
| length(l) <= n = fib (sum(take 2 l) : l) n
| otherwise = l
def paths(gs):
void = [2**i for i in range(gs,0,-1)]
p = 2**(2*gs)+2 - sum(void)*2
print(p, void)
return p
paths(20)
p1 = paths(1)
p2 = paths(2)