Number of compositions
ncompositions(n, k = NULL, bigz = FALSE)compositions for generating all compositions and icompositions for iterating compositions
# number of compositions of 10
ncompositions(10)
#> [1] 512
# number of compositions of 10 into 5 parts
ncompositions(10, 5)
#> [1] 126
# integer overflow
if (FALSE) ncompositions(160) # \dontrun{}
ncompositions(160, bigz = TRUE)
#> Big Integer ('bigz') :
#> [1] 730750818665451459101842416358141509827966271488
# zero sized compositions
ncompositions(0)
#> [1] 1
ncompositions(5, 0)
#> [1] 0
ncompositions(5, 6)
#> [1] 0
ncompositions(0, 0)
#> [1] 1
ncompositions(0, 1)
#> [1] 0