binomial

binomial(n,k)

Number of ways to choose k out of n items

Examples

julia> binomial(5, 2)
10

The binomial function calculates the number of ways to choose k elements from a set of n elements.

Example:

julia> binomial(10, 3)
120

This example calculates the number of ways to choose 3 elements from a set of 10 elements, which is equal to 120.

Common mistake example:

julia> binomial(5, 6)
ERROR: DomainError("k > n, k must be less than or equal to n")

In this example, the value of k is greater than n, which is not a valid input. The value of k should always be less than or equal to n.

See Also

abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: