$\mathbb{P}$ is the prime numbers set.
$p \in \mathbb{P}$
$a,b,c \in \mathbb{N}$
$n=a p^b+c$ where
$c= n\bmod p$
$b$ is the highest power of $p$ who divides $n-c$
How to find $\beta$ where $\beta$ is the highest power of $p$ who divides $n!$?
And how to find $\alpha$ where $\alpha$ is $\dfrac{n!}{p^\beta}\bmod p$?
$n!=\alpha p^\beta$
Probably the answer will appear $a$, $b$, $c$, $p$ and factorials.
Obs.:
$x = y\bmod z \iff x \equiv y \pmod{z}$ and $0 \leq x \leq z-1$
$x,y,z \in \mathbb{N}$
and $0 \le c
, and something a bit messier otherwise.
– 2011-11-08, then until you run out of $p$'s, $\lfloor\frac{n}{p^k}\rfloor=ap^{b-k}$. If $a$ is also $
, the required sum is just the finite geometric progression which I will write backwards as $a+ap+\cdots+ap^{b-1}$.
– 2011-11-08