How to do large modulus by hand? How would I compute something like $2018^{2018} \bmod n$ by hand? 
Additionally, how would I solve something like: $2018^{2018} \bmod n = 0$?
 A: So given some base $b$ and exponent $e$ then for the form $b^e \mod n$ with $b, e \in \mathbb{Z}^+$ we begin by taking powers of $b$ sequentially with $b^0, b^1,b^2,b^3$,... until we find some $k \leq n$ such that $b^0 \equiv 1 \equiv b^k \mod n$. Then we do division with remainder to factor $e = kq + r$ and note that $b^e = b^{kq + r} = (b^{kq})(b^r)=(b^k)^q(b^r)$ and then because $(b^k)^q \equiv 1 \mod n$ this simplifies to  $b^r \mod n$ which was calculated when finding the value of $k$. Essentially the values are periodic modulo $n$ and we exploit this to simply the calculation.
For the case when we consider $b^e \equiv 0 \mod n$ this will be true if and only if $b$ divides $n$ and $e \geq \frac{n}{b}$. See if you can parse out why using similar reasoning to what I used above.
As for one additional trick rather than using $0,1,2,...,n-1$ for your calculations instead center around zero and use positive and negative values. Say for modulo $7$ you can reduce to $\{-3,2,1,0,1,2,3\}$ to keep the numbers small at the expense of tracking the sign changes. Overall I find it faster for hand calculations.
