News for hackers. Stuff that matters.
Re:Ask HN: algorithm to slice a number into parts by VarunGupta on Wednesday January 21, 2009 @06:44AM (#443089)
There can be many ways to do so, one of them is already described by cperciva.

Another can be,

a) All Integers n1 = n2 = n3 =.....= n[m-1] = int(n / m) and nm = n - (n1 + n2 + n3 +.....+ n[m-1])

b) Floats n1 = n2 = n3 =.....= n[m] = n / m

I feel the problem can be more serious if you want the parts to be in certain fashion or distribution.

There are no comments on this comment yet.