Partitions of an integer
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
cominat::partitions(n) returns the number
of partitions of the integer
A partition of a nonnegative integer
a non-increasing list of positive integers with total sum
There are 5 partitions of 4:
Counting is done efficiently with Euler's pentagonal formula for small values of n and Hardy-Ramanujan-Rademacher's formula otherwise.