partitionsCount | R Documentation |
Calculate the number of partitions/compositions of a vector chosen m
at a time with or without replacement. Additionally, these functions can calculate the number of partitions of multisets.
partitionsCount(v, m = NULL, repetition = FALSE,
freqs = NULL, target = NULL)
compositionsCount(v, m = NULL, repetition = FALSE,
freqs = NULL, target = NULL, weak = FALSE)
v |
Source vector. If |
m |
Width of the partition. If |
repetition |
Logical value indicating whether partitions/compositions should be with or without repetition. The default is |
freqs |
A vector of frequencies used for producing all partitions of a multiset of |
target |
Number to be partitioned. If |
weak |
(Compositions only) Logical flag indicating whether to allow terms of the sequence to be zero. |
A numerical value representing the total number of partitions/compositions.
When the number of results exceeds 2^{53} - 1
, a number of class bigz
is returned.
partitionsGeneral
, compositionsGeneral
## Same interface as partitionsGeneral
partitionsCount(25, 5)
compositionsCount(25, 5, TRUE)
partitionsCount(15, 7, TRUE)
partitionsCount(25, 5, freqs = rep(2, 25))
## Return object of class 'bigz'
partitionsCount(2500, 15, TRUE)
compositionsCount(2500, 15, TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.