multcoef: Multinomial coefficient

View source: R/MultCoef.R

multcoefR Documentation

Multinomial coefficient

Description

Computes the number of permutations of a multiset M of size n.

Usage

multcoef(n, counts)

Arguments

n

The size of M.

counts

The counts for the repeated elements.

Details

For a set M with k unique elements with associate counts n_1, n_2, \ldots, n_k, you only need to specify in the counts argument the counts that are bigger than 1.

Value

It returns the multinomial coefficient

\frac{n!}{n_1!n_2! \ldots n_k!}

where

n = n_1 + n_2 + \ldots + n_k.

Author(s)

Raúl Eyzaguirre.

Examples

# The number of permutations of the letters in the set M = {A, A, A, B, B, C}
multcoef(6, c(3, 2, 1))

# Same result with
multcoef(6, c(3, 2))

reyzaguirre/rhep documentation built on Dec. 2, 2024, 4:22 p.m.