Fermat's Little Theorem
Fermat's little theorem, a famous theorem from elementary number theory,
will be explored in this lab. Let p be a prime and a any positive integer
that is not divisible by p. Then Fermat’s little theorem states that
a^{p1} ≡ 1 mod p.
Fermat's little theorem is the foundation for many results in number theory
and is the basis for several factorization methods in use today.
Exercises
U_{n} Applet (Z_{n} under multiplication) 



 Use the ring structure of Z_{p} and the
U_{n} applet to the right
to verify Fermat's little theorem for
several different primes p and positive integers a which are relatively
prime to p.
 Why does a have to be relatively prime to p? What happens if
gcd(a, p) = p? Give some examples.
 Is p  1 necessarily the smallest positive integer r such that
a^{r} ≡ 1 mod p? Why or why not?
 Use Fermat's little theorem to solve the following linear congruences.
 5x ≡ 14 mod 11
 6x ≡ 10 mod 23
 Use Fermat's little theorem to evaluate 2^{235} mod 19.
 Use Lagrange's theorem from group theory to prove Fermat's little
theorem.
 In some texts, Fermat's little theorem is stated as a^{p} ≡ a mod p
for any integer a. Use the binomial theorem and induction on a
to prove this version of Fermat's little theorem for a >= 0.
(Hint: (x + y)^{p} = x^{p} + y^{p} mod p.)
Use this result to prove Fermat's little theorem for a < 0.
 Is the statement a^{n} ≡ a mod n true if n
is a composite number? Use
the applet to explore this question. (If you get stuck, try n = 341 and a = 2.)