Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Partition number in Haskell, using
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
You can’t perform that action at this time.