A specific problem I am struggling with is:
$99^{99} \equiv 8 (\textrm{mod}\ 97)$
But we are also having a test with only multiple choice questions on friday and a question can look like this:
Which of the following congruence equations are true/right/correct
#1) $99^{99} +1 \equiv 0 (\textrm{mod}\ 101)$
#2) $99^{99} \equiv 1 (\textrm{mod}\ 98)$
#3) $99^{99} \equiv 8 (\textrm{mod}\ 97)$
#4) $99^{99} +1 \equiv 0 (\textrm{mod}\ 100)$
What is a generell method to always be able to solve this no mater how you mix and tricks with the numbers? (I know about FERMAT'S LITTLE THEOREM, but I don't see how this can solve all of them completely)
You have to
reducethe number under the exponent and use lil' Fermat when the modulus is prime:For the nonprime moduli, we may have to compute the value of the totient function at these, but it won't be necessary in the present cases: