ganmodokix / ysn

Template tools for competitive programming
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

Add binomial coefficient with Lucas's theorem #35

Closed ganmodokix closed 7 months ago

ganmodokix commented 7 months ago
\binom{n}{m} \equiv \prod_{i=0}^{k} \binom{n_i}{m_i} \pmod{p}

where $(n, m)$ is a non-negative integer pair which satisfies $n \ge m$ and which entries are represented as $n={nk n{k-1} \ldots n_1 n0}\{(p)}, m={mkm{k-1}\ldots m_1m0}{(p)}$, and the radix $p$ is prime.

https://en.wikipedia.org/wiki/Lucas%27s_theorem https://manabitimes.jp/math/1324