This is causing me a bigger headache than I anticipated.(adsbygoogle = window.adsbygoogle || []).push({});

Basically, given an integer N and a number M, I need a list of all the possible integer partitions of N into M parts such that each part is strictly positive and each part is UNIQUE. I don't want repetitions. Just unique ones.

So for example, with N = 10 and M = 2

1 + 9

2 + 8

3 + 7

4 + 6

are the only possibilities.

I tried to write a code to do it, but just ran into huge headaches because of the necessary recursion. With M > 2, you need to worry about systematically shifting the sequence as you go. Can anybody make a suggestion?

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Partitions of an integer

Loading...

Similar Threads - Partitions integer | Date |
---|---|

A Lebesgue measure and integral | Jan 14, 2018 |

A Examples of fractal structure in prime partition numbers? | Jan 4, 2018 |

I Partitions of Euclidean space, cubic lattice, convex sets | Mar 2, 2016 |

On partitioning an even number into a pair of (relative) primes | Oct 18, 2014 |

What is a partition | Jul 23, 2014 |

**Physics Forums - The Fusion of Science and Community**