How can we use Fermat's Little Theorm to find the least non-negative residue modulo m with numbers with large exponents. For example, how would one find the least non-negative residue modulo m with values $n = 3^{1000000}$ and $m = 19$.
I understand how the basic method works (ie finding a way to introduce a factor of $3^{18}$ and then reducing), but dividing 1000000 by 18 is time consuming and I feel there is a quicker method that I don't understand yet.