Number of partitions
npartitions(n, k = NULL, distinct = FALSE, bigz = FALSE)partitions for generating all partitions and ipartitions for iterating partitions
# number of partitions of 10
npartitions(10)
#> [1] 42
# number of partitions of 10 into 5 parts
npartitions(10, 5)
#> [1] 7
# integer overflow
if (FALSE) npartitions(160) # \dontrun{}
npartitions(160, bigz = TRUE)
#> Big Integer ('bigz') :
#> [1] 107438159466
# zero sized partitions
npartitions(0)
#> [1] 1
npartitions(5, 0)
#> [1] 0
npartitions(5, 6)
#> [1] 0
npartitions(0, 0)
#> [1] 1
npartitions(0, 1)
#> [1] 0