How to solve this kind of Olympiad problems? This kind of question is often asked in olympiads:

Find the remainder when $a^n$ is divided by b where n is a very large
  number and a and b are whole numbers.

What is the general trick to solve this kind of problems? I looked for a solution to the problem: 

Find the remainder when $19^{92}$ is divided by $92$.

In the solution, Fermat's Little Theorem was used. I didn't understand it properly. Can someone help me to understand the method of solving this kind of problems? 
 A: The Fermat's little theorem says that if $p$ is a prime then for any integer $a$, $p$ divides $a^p-a$. In your case, Note that $19^{92}$ is nothing but $19^{23*4}$. So what we do is, we split $92=23*4$, and then use the Chinese remainder theorem(CRT) along with the Fermat's little theorem (FLT), like this:
(I hope you know congruences, otherwise read them up from Wiki, they really simplify life)
We will calculate $19^{92}$ remainders with divisors $4$ and $23$, and combine them using CRT. 
\begin{align}
 19 \equiv -1 \mod 4 \\
& \implies 19^{92} \equiv (-1)^{92} \equiv 1 \mod 4   
\end{align}
and
\begin{align}
19^{23} \equiv 19 \mod 23 (\text{by FLT})\\ 
& \implies 19^{92} \equiv 19^4 \equiv (-7)^2 \equiv 3 \mod 23
\end{align}
Now $4$ and $23$ are coprime numbers, so by the CRT, there is a unique number between $1$ and $92$ that satisfies both the above congruence relations. By inspection of the multiples of $23$, we figure out that $49$ is that number, and hence $19^{92} \equiv 49 \mod 92$.
Now if you ask for a general formula, I cannot say anything, however the best thing to do is to look for little little patterns. I'll give an example.
Suppose you have to calculate the remainder when $7^{2592}$ is divided by $344$. Of course, you are tempted to break $344=43*8$, but before that, realize that $7^3=343$, which is only $-1$ away from $344$. Hence, a shortcut would say:
$7^{2592}=7^{864*3}=(7^3)^{864} \equiv -1^{864} \equiv 1 \mod 344$.
So that is one trick. Another trick is what I have described above using CRT and FLT. The third trick, useful for prime powers, is like this:
Suppose I want to calculate $10^{597} \mod 343$ (which is the remainder when the former is divided by the latter). Here we use Euler's totient theorem, which is a generalization of FLT. The totient function of $p^n$ where $p$ is a prime, is just $p^{n-1}$.Hence we say that $10^{49} \equiv 1 \mod 343$. Now, $597=49*12+9$, so the above problem reduces to finding $10^9 \mod 343$. Again, you use a common trick: $10^3$ is $1000$, and $343*3=1029$, so $10^3 \equiv -29 \mod 343$, and so $10^9 \equiv -(29^3) \mod 343 = 223 \mod 343$ (now I brute force).
These are some tricks that you can use. There are some deeper problems than this (e.g. proving that some equation have no solution) where you have to guess quadratic congruences etc. and find appropriate moduli for your problem. So hope this was of some help.
