Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ncompositions

Number of compositions


Description

Number of compositions

Usage

ncompositions(n, k = NULL, bigz = FALSE)

Arguments

n

an non-negative integer to be partitioned

k

number of parts

bigz

an logical to use gmp::bigz

See Also

compositions for generating all compositions and icompositions for iterating compositions

Examples

# number of compositions of 10
ncompositions(10)
# number of compositions of 10 into 5 parts
ncompositions(10, 5)

# integer overflow
## Not run: ncompositions(160)
ncompositions(160, bigz = TRUE)

# zero sized compositions
ncompositions(0)
ncompositions(5, 0)
ncompositions(5, 6)
ncompositions(0, 0)
ncompositions(0, 1)

arrangements

Fast Generators and Iterators for Permutations, Combinations, Integer Partitions and Compositions

v1.1.9
MIT + file LICENSE
Authors
Randy Lai [aut, cre]
Initial release
2020-09-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.