Skip to contents

Uses the multiplicative recurrence \(\binom{n}{k} = \prod_{i=1}^{k} (n-k+i)/i\), in which every partial product is exactly divisible by \(i\). That keeps the whole computation inside multiplication and small division, and never needs long division.

Usage

morie_big_binom(n, k)

Arguments

n, k

Whole numbers.

Value

A morie_bigint.

Details

choose() in base R returns 100891344545563076171808112640 for \(\binom{100}{50}\); the exact value is 100891344545564193334812497256, so the two differ from the thirteenth significant digit.

Examples

morie_big_binom(n = 5L, k = 5L)
#> 1