Inverse linear recursive factorial

Original link: http: //www.cnblogs.com/adelalove/p/9915175.html
since the inverse function of the product is entirely i.e.,
f (m * n) = f (m) * f (n)
then
f (i + 1) = 1 '* 2' * ........ * i '* (i + 1)'
both sides simultaneously by the (i + 1)
on the left to obtain f (i + 1) * ( i + 1 )
the right to give 1 '* 2' * ........ * i '= f (i)
then f (i) = f (i + 1) * (i + 1)
seeking 1! ! MAXN to the inverse element
INV [MAXN] = mod_pow (FAC [MAXN], MOD-2);
for (I = LL-MAXN. 1; I> = 0; i--)
INV [I] = (INV [I +1] * (i + 1) )% mod;

Guess you like

Origin www.cnblogs.com/cutemush/p/12005990.html