# integer_partitions function

All the ways to write a whole number as a sum of positive whole numbers.

## How to write it

### integer_partitions(n)

**n**

A whole number. Takes a whole number.

## Examples

- $\displaystyle \operatorname{integer\_partitions}(4) = \left[ \left[ 4 \right], \left[ 3, 1 \right], \left[ 2, 2 \right], \left[ 2, 1, 1 \right], \left[ 1, 1, 1, 1 \right] \right]$

  `integer_partitions(4)`

  In the solver, `integer_partitions(4)` gives `[[4], [3, 1], [2, 2], [2, 1, 1], [1, 1, 1, 1]]`.

  [Open in the solver](https://hilberon.com/?q=integer_partitions%284%29)

## Related functions

- [integer_exponent](https://hilberon.com/library/integer_exponent)

  The exponent of a prime in a whole number.
- [factor_integer](https://hilberon.com/library/factor_integer)

  Prime factorization of a whole number, as a list of prime and exponent pairs.
- [partitions_p](https://hilberon.com/library/partitions_p)

  How many ways a whole number is a sum of positive whole numbers, in any order of terms.
- [partitions_q](https://hilberon.com/library/partitions_q)

  How many ways a whole number is a sum of distinct positive whole numbers.
- [is_coprime](https://hilberon.com/library/is_coprime)

  Test whether two whole numbers have no common divisor above 1.
- [is_prime](https://hilberon.com/library/is_prime)

  Test whether a whole number is prime.

---
Source: https://hilberon.com/library/integer_partitions
