Inverse Euler theorem to calculate $\binom{n}{r}$ How can we use Inverse  Euler theorem or properties to calculate the binominal coefficients or say $\binom{n}{r}$? What is the algorithm for this ?
An example for the same will be greatly appreciated. I came across this code which calculates the binomial coefficient but makes use of inverse Euler - Link
 A: In the link you have given, the program does not calculate $\binom{n}{r}$, but rather it calculates $\binom{n}{r} \pmod{p}$ where $p$ is prime (and the description gives a rough outline of the algorithm when $p$ is not prime).
The program first calculates $n! \pmod{p}$, and then it calculates $\big(r!\big)^{-1} \pmod{p}$ and $\big((n-r)!\big)^{-1} \pmod{p}$, where the exponent of $-1$ signifies the multiplicative inverse. It relies on the fact that for any $a$ such that $\gcd(a, p) = 1$, $a^{p-1} \equiv 1 \pmod{p}$ by Fermat's Theorem. Thus $a\cdot a^{p-2} \equiv 1 \implies a^{-1} \equiv a^{p-2}$ and the inverses of the factorials can be calculated relatively easily. Finally, $\binom{n}{r} \equiv n! \cdot \big(r!\big)^{-1} \cdot \big((n-r)!\big)^{-1} \pmod{p}$.
To make the actual computation easier, the program calculates the residues of the factorials and exponents at every step of multiplication, so that the values that are being dealt with are small.
Note that $\gcd(n, p) = 1$ is assumed here. If $p$ is not prime, you can factorize $p$ and calculate the residue of the binomial modulo all the prime factors, and then combine the results using the Chinese Remainder Theorem.
