Partition Function


by mak
Tags: function, partition
mak
mak is offline
#1
Nov25-05, 06:00 AM
P: 1
Hi everyone,

I am trying to define a function partition in Haskell that takes in an integer as an argument and returns a list of all possible positive integers that would sum to the input, ie

partition 4 = [[1, 1, 1, 1], [1, 1, 2], [1, 3], [2, 2], [4]]

The function (formally defined) can be found here
http://en.wikipedia.org/wiki/Partiti...mber_theory%29

From the outset it looks like i'll need to increment and decrement different variables on each recursive call, but have no idea where to start. Sorry if this seems trivial, but i think it's rather difficult for a beginners tutorial :)

Thanks for your help
Phys.Org News Partner Science news on Phys.org
Better thermal-imaging lens from waste sulfur
Hackathon team's GoogolPlex gives Siri extra powers
Bright points in Sun's atmosphere mark patterns deep in its interior

Register to reply

Related Discussions
Partition Function Advanced Physics Homework 3
partition function Advanced Physics Homework 5
Zeros of the partition function Quantum Physics 1
Partition function Advanced Physics Homework 4
divergence of a partition function Quantum Physics 9