This is a proof from a book on number theory I'm reading. I'm having a hard time following. I think there's a variable here that means two different things at two different times...
Theorem:
If n is a positive integer and p is a prime, then $p^e \vert\vert n!$, where $e=\lfloor\frac{n}{p}\rfloor + \lfloor\frac{n}{p^2}\rfloor + \dots + \lfloor\frac{n}{p^r}\rfloor$ and r is determined by n by the inequality $p^r \le n <p^{r+1}$
Proof:
For a given integer k, the multiples of $p^k$ that do not exceed n are $p^k, 2p^k, \cdots, qp^k$ , where q is the largest integer such that $qp^k \le n$. But this says that q is the largest integer not exceeding $n/p^k$, so that $q= \lfloor n/p^k \rfloor$. Thus, $\lfloor n/p^k\rfloor$ gives the number of positive multiples of $p^k$ that do not exceed n.
Interlude:
I understand the proof so far. We've simply chosen some power of p and shown that $\lfloor n/p^k \rfloor$ is the largest integer that we can multiply by $p^k$ and stay under n. Here's where I start to get confused.
Now, if $1 \le m \le n$, then $m=qp^k$ with $(q,p) = 1, 0 \le k \le r$, and m contributes precisely k to the total exponent e with which p appears in the canonical representation of n!
Interlude 2:
How exactly does $m=qp^k$ follow from $1 \le m \le n$? Also, this q seems to mean something other than $\lfloor n/p^k\rfloor$ since we seem to be considering the set of all numbers less than or equal to n and greater than or equal to 1 that have the form $m=qp^k$?
Moreover, m is counted precisely k times by the sum
$\lfloor\frac{n}{p}\rfloor + \lfloor\frac{n}{p^2}\rfloor + \dots + \lfloor\frac{n}{p^r}\rfloor$,
once as a multiple of p, once as a multiple of $p^2$, ... , once as a multiple of $p^k$, and no more. Of course, if $k=0$, then m is not counted in the sum. Therefore, the sum above accounts exactly for the contribution of each m between 1 and n to the exponent e as claimed.
Interlude 3:
What exactly is meant here by counted? I really don't understand the last part of this proof at all...