Create a gist now

Instantly share code, notes, and snippets.

Embed
Partition number in Haskell, using https://gist.github.com/1438136
integers = 0 : concat [[x,(-x)] | x <- [1..]]
generalizedPentagonalNumbers = [(3 * n^2 - n) `div` 2|n<-integers]
partitionNumbers = rec [1] (cycle [1,1,-1,-1]) (tail generalizedPentagonalNumbers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment