<s>[INST] Prove that $\binom{ap}{p} \equiv a \pmod{ap}$ 
Let $N = ap$ be a composite positive integer, where $a > 1$ is a positive integer and $p$ is a prime. Prove that $$\binom{ap}{p} \equiv a \pmod{ap}.$$

We have $$\binom{ap}{p} = \dfrac{ap(ap-1) \cdots (ap-(p-1))}{p!} = \dfrac{a(ap-1)(ap-2) \cdots (ap-(p-1))}{(p-1)!}.$$ If $p$ is the smallest prime factor of $ap$, then $(p-1)!$ has an inverse modulo $ap$. Also, $(ap-1)(ap-2) \cdots (ap-(p-1)) \equiv (-1)^{p-1} (p-1)!$. If $p = 2$, then $$\binom{ap}{p} \equiv a \cdot \dfrac{-(p-1)!}{(p-1)!} \equiv -a \equiv a \pmod{ap}.$$ Otherwise, if $p > 2$ is odd then $$\binom{ap}{p} \equiv a \cdot \dfrac{(p-1)!}{(p-1)!} \equiv a \pmod{ap}.$$ How do we prove it in the case that $p$ is not the smallest prime factor of $ap$?
 [/INST] using Lucas'Theorem, suppose $a\equiv k \pmod p $, we will have:
$\binom{ap}{p} \equiv\binom{k}{1} =k \equiv a \pmod p $
We also have
$\binom{ap}{p} =  \dfrac{a(ap-1)(ap-2) \cdots (ap-(p-1))}{(p-1)!} = a\binom{ap-1}{p-1} \equiv 0 \pmod a$
Let $\binom{ap}{p}=Zp+a$, so $a|Z$, so
$Zp+a=Kap+a \equiv a \pmod {ap} $
</s>