
#1
Nov2505, 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 


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 