News for hackers. Stuff that matters.

adm

Ask HN: algorithm to slice a number into parts

I am trying to write a algorithm to slice a number into parts; such that those slices add upto original number. e.g. n = (n1 + n2+ .. + nm) where n is number and m no of slices. n will be positive integer and m won't exceed 50. Do you know any algorithm for this?Edit: slices should be of distinct values.

( Read More... | 14 comments | 6 points | on HN )
Re:PG books free to a good home on Monday September 08, 2008 @06:35AM (#298171)
(Nero Wolfe)

... Archie was in a shock, and reason was neither that all the orchids were stolen from Wolfe's gallery or is been out for (more than two) times in a day to solve mystery. Archie started thinking. Until in my career, I never saw that fat bastard taking money from a client without Solving the case and being satisfied that he has really earned the money. But what the hell is this? some 'Lisper offers him a couple books (and think what, those are related to LISP which I here are related to black magic, No wonder; Wolfe will enjoy those and will give me hell solving all the mysteries after reading those), And he accepts those? Something is wrong.