Ask HN: algorithm to slice a number into parts
https://news.ycombinator.com/item?id=443072I 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.