Register to reply

Partition Function

by mak
Tags: function, partition
Share this thread:
mak
#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
Scientists develop 'electronic nose' for rapid detection of C. diff infection
Why plants in the office make us more productive
Tesla Motors dealing as states play factory poker

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