Online Algebra Calculator
Many of users do not use powerful Maxima computer algebra system for systematic work, but for ad hoc algebraic calculations – equations, functions, matrixes, etc. only. To do this job, it is not useful to download the whole application from a web site.
Function: integer_partitions (<n>)

Function: integer_partitions (<n>, <len>) Returns integer partitions of <n>, that is, lists of integers which sum to <n>.
integer_partitions(<n>) returns the set of all partitions of the integer <n>. Each partition is a list sorted from greatest to least.
integer_partitions(<n>, <len>) returns all partitions that have length <len> or less; in this case, zeros are appended to each partition with fewer than <len> terms to make each partition have exactly <len> terms. Each partition is a list sorted from greatest to least.
A list [a_1, ..., a_m] is a partition of a nonnegative integer n when (1) each a_i is a nonzero integer, and (2) a_1 + ... + a_m = n. Thus 0 has no partitions.
Examples:
(%i1) integer_partitions (3);
(%o1) {[1, 1, 1], [2, 1], [3]}
(%i2) s: integer_partitions (25)$
(%i3) cardinality (s);
(%o3) 1958
(%i4) map (lambda ([x], apply ("+", x)), s);
(%o4) {25}
(%i5) integer_partitions (5, 3);
(%o5) {[2, 2, 1], [3, 1, 1], [3, 2, 0], [4, 1, 0], [5, 0, 0]}
(%i6) integer_partitions (5, 2);
(%o6) {[3, 2], [4, 1], [5, 0]} To find all partitions that satisfy a condition, use the function subset; here is an example that finds all partitions of 10 that consist of prime numbers.
(%i1) s: integer_partitions (10)$
(%i2) cardinality (s);
(%o2) 42
(%i3) xprimep(x) := integerp(x) and (x > 1) and primep(x)$
(%i4) subset (s, lambda ([x], every (xprimep, x)));
(%o4) {[2, 2, 2, 2, 2], [3, 3, 2, 2], [5, 3, 2], [5, 5], [7, 3]}(%o1) true (%i2)