Modulus of Combination Number (Fermat's Little Theorem)

Assuming the result of Cnk modulo mod, you can use the inverse element + Fermat's little theorem to find it.

official

When mod is prime number
n/m%mod=(n*m^(mod-2))%mod

When used, it is generally combined with quick power.

Guess you like

Origin blog.csdn.net/p15008340649/article/details/113528486