BigCombinatorics._master_table
— ConstantThis is where we cache values already computed
BigCombinatorics.Bell
— MethodBell(n)
gives the n
-th Bell number, that is, the number of partitions of an n
-element set. See https://oeis.org/A000110
BigCombinatorics.Binomial
— MethodBinomial(n,k)
returns the binomial coefficient n
-choose-k
. This is the number of k
-element subsets of an n
-element set. See https://oeis.org/A007318
BigCombinatorics.Catalan
— MethodCatalan(n)
returns the n
-th Catalan number. See https://oeis.org/A000108
BigCombinatorics.Derangements
— MethodDerangements(n)
returns the number of permutations of an n
-set that have no fixed point. See https://oeis.org/A000166
BigCombinatorics.DoubleFactorial
— MethodDoubleFactorial(n)
returns n!!
, i.e., n*(n-2)*...
with (-1)!! == 0!! == 1!! == 1
. See https://oeis.org/A006882
BigCombinatorics.Euler
— MethodEuler(n)
returns the n
-th Euler number. Starting with n=0
this is the sequence 1, 0, -1, 0, 5, 0, -61, 0, 1385 and so on. See https://oeis.org/A122045
Not to be confused with Eulerian
.
BigCombinatorics.Eulerian
— MethodEulerian(n,k)
returns the number of permutations of {1,2,...,n}
with k
ascents. See https://oeis.org/A008292
Not to be confused with Euler
.
BigCombinatorics.Factorial
— MethodFactorial(n)
returns n!
for nonnegative integers n
. See https://oeis.org/A000142
Factorial(n,k)
returns n!/k!
(to be consistent with Julia's factorial
.) Requires 0 <= k <= n
.
See also FallingFactorial
and RisingFactorial
.
BigCombinatorics.FallingFactorial
— MethodFallingFactorial(n,k)
returns n*(n-1)*(n-2)*...*(n-k+1)
(with a total of k
factors). Requires n,k >= 0
. If k>n
then 0
is returned.
BigCombinatorics.Fibonacci
— MethodFibonacci(n)
returns the n
-th Fibonacci number. We begin with Fibonacci(0)==0
and Fibonacci(1)==1
. See https://oeis.org/A000045
BigCombinatorics.HyperFactorial
— MethodHyperFactorial(n)
returns the hyperfactorial of n
, that is 1^1 * 2^2 * 3^3 * ... * n^n
. See https://oeis.org/A002109
BigCombinatorics.IntPartitions
— MethodIntPartitions(n)
is the number of partitions of the integer n
. See https://oeis.org/A000041
IntPartitions(n,k)
is the number of partitions of the integer n
with exactly k
(nonzero) parts.
BigCombinatorics.IntPartitionsDistinct
— MethodIntPartitionsDistinct(n,k)
is the number of partitions of the integer n
into exactly k
distinct parts.
IntPartitionsDistinct(n)
is the number of partitions of n
into distinct parts.
BigCombinatorics.Menage
— MethodMenage(n)
Number of solutions to the Menage problem with n
male/female couples. See https://oeis.org/A059375
BigCombinatorics.MultiChoose
— MethodMultiChoose(n,k)
returns the number of k
-element multisets that can be formed using the elements of an n
-element set.
Warning: This is not the same as Multinomial
.
BigCombinatorics.Multinomial
— MethodMultinomial(vec)
returns the multinomial coefficient whose top index is the sum of vec
(an array of Int
s) and whose bottom indices are given by vec
.
This may also be called with a common-separated list of arguments, that is, either of Multinomial([1,2,3])
or Multinomial(1,2,3)
. The result is 60
in both cases as these equal 6!/(1! 2! 3!)
.
Warning: This is not the same as MultiChoose
.
BigCombinatorics.PowerSum
— MethodPowerSum(n,k)
returns the sum of the k
-th powers of the integers 1
through n
, i.e., 1^k + 2^k + 3^k + ... + n^k
.
BigCombinatorics.RisingFactorial
— MethodRisingFactorial(n,k)
returns n*(n+1)*(n+2)*...*(n+k-1)
(with a total of k
factors). Requires n,k >= 0
.
BigCombinatorics.Stirling1
— MethodStirling1(n,k)
gives the (signed) Stirling number of the first kind, that is, the coefficient of x^k
in the poynomial x(x-1)(x-2)...(x-n+1)
. See https://oeis.org/A008275
BigCombinatorics.Stirling2
— MethodStirling2(n,k)
gives the Stirling number of the second kind, that is, the number of paritions of an n
-set into k
-parts." See https://oeis.org/A008277
BigCombinatorics._get
— Method_get(f::Function, x)
Retrieve the function value f(x)
from the _master_table
.
BigCombinatorics._has
— Method_has(f::Function, x)
Check if argument x
for function f
is already in the _master_table
.
BigCombinatorics._make
— Method_make(f::Function, T::Type)
Create an entry in the _master_table
for the function f
.
BigCombinatorics._max_arg
— Method_max_arg(f::Function)
Find the largest argument known for f
. Note that f
must be a function of just a single value.
BigCombinatorics._save
— Method_save(f::Function, x, val::BigInt)
Save the computed value of f
with argument(s) x
and value val
.
BigCombinatorics.cache_clear
— MethodBigCombinatorics.cache_clear()
Clears all cached values.
BigCombinatorics.cache_report
— MethodBigCombinatorics.cache_report()
reports how many entries are saved for each function in the BigCombinatorics
module.