Compute the ratio of factorials using Prime Factorization. For example, ComputeDivFact(c(a, b), c(d, e, f)) computes \(\frac{a! b!}{d! e! f!}\).

ComputeDivFact(num, deno = NULL, out.log = FALSE)

Arguments

num

The vector of all numbers which have their factorials in the numerator.

deno

The vector of all numbers which have their factorials in the denominator. Default is NULL, there is only a numerator.

out.log

Is the logarithm of the result returned instead? Default is FALSE.

Value

The result of the ratio or its logarithm if out.log = TRUE.

See also

choose

Examples

choose(100, 20)
#> [1] 5.359834e+20
ComputeDivFact(100, c(20, 80))
#> [1] 5.359834e+20
lchoose(100, 20)
#> [1] 47.73063
ComputeDivFact(100, c(20, 80), out.log = TRUE)
#> [1] 47.73063
factorial(100)
#> [1] 9.332622e+157
ComputeDivFact(100)
#> [1] 9.332622e+157
lfactorial(100)
#> [1] 363.7394
ComputeDivFact(100, out.log = TRUE)
#> [1] 363.7394