# Homework Help: Fermat's Little Theorem

1. Apr 3, 2012

1. The problem statement, all variables and given/known data
Use Fermat's Little Theorem to calculate 18$^{802}$(mod29)

2. Relevant equations
Fermat's Little Theorem: a$^{p-1}$$\equiv$1(modp)
where in this case, a=18 and p=29

3. The attempt at a solution
By FLT, I found that 18$^{28}$$\equiv$1(mod29)
So, 18$^{802}$$\equiv$(18$^{28}$)$^{28.5}$*18$^{4}$(mod29)$\equiv$18$^{4}$(mod29)$\equiv$25(mod29)

So my solution is 25(mod29).
However, the solution my professor posted is 4(mod29) (**NOT -4(mod29)**). Pretty confused here... Is there something wrong in my logic?

2. Apr 4, 2012