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

npartitions

Number of partitions


Description

Number of partitions

Usage

npartitions(n, k = NULL, distinct = FALSE, bigz = FALSE)

Arguments

n

an non-negative integer to be partitioned

k

number of parts

distinct

an logical to restrict distinct values

bigz

an logical to use gmp::bigz

See Also

partitions for generating all partitions and ipartitions for iterating partitions

Examples

# number of partitions of 10
npartitions(10)
# number of partitions of 10 into 5 parts
npartitions(10, 5)

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

# zero sized partitions
npartitions(0)
npartitions(5, 0)
npartitions(5, 6)
npartitions(0, 0)
npartitions(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.