News for hackers. Stuff that matters.
Re:Ask HN: algorithm to slice a number into parts by kurtosis on Wednesday January 21, 2009 @08:50AM (#443196)
if interested in integer partitions this python should do the job

def intpart(n):

    if n == 0:

        yield []

    for k in range(1,n+1):

        for p in intpart(n-k):

            yield [k] + p

i believe that this isn't truly integer partitions because it will count 4 = 1,1,2,1 and 1,1,1,2 as different partitions but that's all I can give you between breakfast and work.

see wikipedia for integer partiton or young tableau for more on these interesting objects

There are no comments on this comment yet.