Fermat's little theorem states that if p is a prime number, then for any integer a, the number a p − a is an integer multiple of p. In the notation of modular arithmetic, this is expressed as
For example, if a = 2 and p = 7, 27 = 128, and 128 − 2 = 7 × 18 is an integer multiple of 7.
If a is not divisible by p, Fermat's little theorem is equivalent to the statement that a p − 1 − 1 is an integer multiple of p:
The quickest proof follows. Take the series below:
Using an example of a=3 and p=17 is shown in the table below. Note the jumble of all values 1 through (p-1) in column D. All the values 1 through 16 are there once and only once just not in the order you are accustomed to.
So the value is equal to:
It is in the above paragraph of mathematics that you can see that all the numbers must be relatively prime to p in order for the derivation to work and the relation to hold.
Which leads to the interesting phrase
Below is an example of the values of this phrase with p=5
Fermat's Little Theorem Spreadsheet
Observation: Relationship of the Roots of the Polynomial
Using the example assuming p=5 you get the following root map:
and this relationship works for all the coprimes.