PART2K is a DOS BASIC program to find partitions of a number n into all the integer parts that add up to that sum, with the optional constraints that all partitions have just m parts, that all parts are unique, and that all parts be <= p. It computes P(n), Q(n), P(n,m), and Q(n,m). I wrote this program to solve a problem that arises with with magic squares and other recreational math stumpers: what are all the ways in which m different numbers can add up to n, without regard to order? Partitioning is a bit like factoring in that it decomposes a number, but it uses addition rather than multiplication. This was a fun programming challenge that uses recursive functions.
Last update: 9 Jan 2000
Download PART2K.ZIP (50K)