Huaizhong's solution is only correct if the order of the ni counts, so that 7 = 4+3 and 7 = 3+4 are different solutions. The asker of the question did not appear to specify whether order counted or not.
If order does not matter, then the problem is very different and much harder, so hard that it was not solved completely until the 1930's. Some extreme values of r lend themselves to easy solutions: if r = 2, for example, then the number of partitions is (n-1)/2 or n/2, whichever is a whole number, while if r = n-1, there will only be one possible partition regardless of the value of n.


Huaizhong R.
06/17/25
Huaizhong R.
06/17/25