p - Factorization modulo n I learned that ${n!} = p^{e}n_0$ where $e = \sum\limits_{k = 1}^\infty \lfloor\frac{n}{p^{k}}\rfloor$ where n is the number, p is the prime, $n_0$ is the product of factors of n! divided by $p^{e}$. Does it has something to do with this problem? Or Im referring to different thing?
Prove that: $\frac {n!}{p^{k}}\equiv(-1)^{k}k!(n - pk)!$mod p where $k = \lfloor\frac{n}{p}\rfloor$

Case 1 : $k=\lfloor \frac{n}{p} \rfloor=0$ , so we have $\frac{n!}{p^0} = (-1)^0 * 0! *(n-0*p)! \mod p $ => $ n! = n! \mod p$ which is true.
Case 2 : $k=\lfloor \frac{n}{p} \rfloor=1$ , so we have $\frac{p!}{p} = (-1)^1 *1! *(0)! \mod p $ => $ (p-1)! = -1 \mod p$ which is true Wilson's Theorem
Assume its true for $n$ and we want to prove it for $n+1$,
There are two cases $ k=\lfloor \frac{n}{p} \rfloor = \lfloor \frac{n+1}{p} \rfloor$ or $ k=\lfloor \frac{n}{p} \rfloor , k+1 = \lfloor \frac{n+1}{p} \rfloor$
For the First case we need to prove that $\frac{(n+1)!}{p^k} = (-1)^k * k! *(n+1- p k)! \mod p$ given that $\frac{n!}{p^k} = (-1)^k * k! *(n-p k)! \mod p$
So we get that $\frac{(n+1) n!}{p^k} = (-1)^k *k!*(n-pk)! (n+1 -p k) \mod p $
From the assumption we get that $(n+1) (-1)^k *k! *(n-pk)! = (-1)^k *k!*(n-pk)! (n+1 -p k) \mod p$ which is just $(n+1-n-1+p k) (-1)^k *k! *(n-pk)! =0 \mod p$ which is true since $ pk =0 \mod p$.
For the second case we need to prove that $\frac{(n+1)!}{p^{k+1}} = (-1)^{k+1} (k+1)! (n+1-p (k+1))! \mod p$ given that $\frac{n!}{p^k} = (-1)^k * k! *(n-pk)! \mod p$
Obviously that $n+1 = (k+1)p$ since $\lfloor \frac{n}{p} \rfloor = k$ and $\lfloor \frac{n+1}{p} \rfloor = k+1$.
So $\frac{(n+1)!}{p^{k+1}} = (-1)^{k+1} (k+1)! (0)! \mod p$
Which is $\frac{(n+1) n!}{p^k p} = (-1)^{k+1} (k+1)! \mod p$
Which is $\frac{(k+1)p}{p} \frac{n!}{p^k} = (-1)^{k+1} (k+1)! \mod p$
By the assumption and the fact that $n+1=(k+1)p$ we get that its $(k+1) (-1)^k *k! *((k+1)p-1-p k)! = (-1)^{k+1} (k+1)! \mod p $ =>  $(k+1)! (-1)^k (p-1)! = (k+1)! (-1)^{k+1} \mod p $ by Wilson's Theorem we get that $(p-1)! =-1 \mod p$,
So we arrive at $(k+1)! (-1)^k *-1 = (k+1)! (-1)^{k+1} \mod p$
Which is true,thus concluding the proof.
Note : I did not use the Legendre formula in the proof which is $e =\sum \limits_{k=1}^{\infty} \lfloor \frac{n}{p^k} \rfloor$, the main idea in my proof is Wilson's Theorem, yet there might be a proof using Legendre formula (i am not familiar with that).
