Binomial coefficient modulo

210 Views Asked by At

It is well known that $ \gcd(n,r) = 1 \implies \binom{n}{r} \equiv 0 \mod n $

Then my doubt is that is there any general formula if $\gcd(n,r) \ne 1$

I.e.,

$$r \ne 0 \land r \ne n \land \gcd(n,r) \ne 1 \implies \binom{n}{r} \equiv ? \mod n$$

If $r=0,n$, then obviously $?= 1$.