Number of compositions
ncompositions(n, k = NULL, bigz = FALSE)
n | an non-negative integer to be partitioned |
---|---|
k | number of parts |
bigz | an logical to use gmp::bigz |
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) ncompositions(160, bigz = TRUE)#> Big Integer ('bigz') : #> [1] 730750818665451459101842416358141509827966271488# zero sized compositions ncompositions(0)#> [1] 1ncompositions(5, 0)#> [1] 0ncompositions(5, 6)#> [1] 0ncompositions(0, 0)#> [1] 1ncompositions(0, 1)#> [1] 0