Nested modular arithmetic I can't seem to grasp if/why you can have repeatedly take mod's at intermediate steps and still have the result be true, looking at the following equivalence:
$[u -c*(a^{|u|-1})] \mod{p} = [u-c*(a^{|u|-1}\mod{p})] \mod{p}$ (If c is the first digit of u, this recalculates u mod p without the first digit). 
If we take the mod of $a^{|u|-1}$, wouldn't we end up subtracting a much smaller number from u (say, 1 instead of 10), which could very well affect the result of the final expression mod p? 
Some sort of intuition accompanied by a somewhat rigorous proof would be appreciated -- and if anyone can point me towards any resources to help me get a better grasp of more complex modular arithmetic beyond the basics, I'd be very happy to learn more. Thanks in advance.
 A: I know that what I write is not an answer to your question, but I recommend strongly thinking of congruence modulo $p$ as an equivalence relation, and not thinking of “mod” as a function that you apply to numbers.
So we write $a\equiv b\pmod p$ to mean no more and no less than that $b-a$ is a multiple of $p$, or as we like to write, $p|(b-a)$. Then congruence modulo $p$ behaves like equality but isn’t: you have $a\equiv a\pmod p$; if $a\equiv b\pmod p$ then $b\equiv a\pmod p$; and if both $a\equiv b\pmod p$ and $b\equiv c\pmod p$, then $a\equiv c\pmod p$.
Then you show easily enough that if $a\equiv a'\pmod p$ and $b\equiv b'\pmod p$, then $a+b\equiv a'+b'\pmod p$, and you also get $ab\equiv a'b'\pmod p$. These mean that congruence modulo $p$ respects addition and multiplication, so that if you’re only interested in what some messy expression turns out to be modulo $p$, you can replace the ingredients by things congruent to them, not only at the initial stage of your computation, but at any stage you want. Want to know the final decimal digit of $17^{50}$? That’s asking for the congruence of $17^{50}$ modulo $10$. You see that $17^0=1\equiv1\pmod{10}$, $17^1=17\equiv7\pmod{10}$, $17^2\equiv7^2=49\equiv-1\pmod{10}$, and $17^3\equiv7^3=7^2\cdot7\equiv-1\cdot7=-7\pmod{10}$, and finally $7^4=(7^2)^2\equiv(-1)^2=1\pmod{10}$, and from then on, they cycle through $1,7,-1,-7$ repeatedly. So you see that $17^{50}\equiv17^2\equiv-1\equiv9\pmod{10}$, and the final digit of $17^{50}$ is $9$.
Note that I was scrupulous in writing congruence (\equiv) when things were merely congruent, and equality ($=$) when things were equal. Note also that I never did subtractions, just replaced things by other things congruent to them whenever I felt like it.
A: Writing $\ A = a^{|u|-1},\,$ and $\ \bar A = (A\ {\rm mod}\ p),\ $
  we aim to prove
$$ (u - c A)\ {\rm mod}\ p\, =\, (u - c \bar A)\ {\rm mod}\ p$$  
Because $\ A\equiv \bar A\pmod p,\,$ the congruence sum and product rules imply
$$ u-cA\,\equiv\, u-c\bar A \pmod p$$
So both sides have the same remainder mod $\,p,\,$ which is the sought result.
Remark $ $ Generally, as above, it is straightforward to prove properties of the mod operator by first converting to congruence form, then applying the arithmetical laws of congruences then, as a final step, convert back to mod operator form. While it is possible to perform such proofs without congruences, generally that will be much messier, and less intuitive.
