(-2)^6 is congruent to 1 modulo 7; for multiples of 7, only the congruence a^7≡a modulo 7 applies; passing a Fermat test does not prove primality.
Explicit prime modulus 7, full multiplication permutation and exact squaring, with composite 341 separately.
Givens and symbols
calc
G1 — p=7,a=-2, normalized to 5 modulo 7; the theorem statements are congruences, not integer equalities.
p — qualified prime modulus
U_7 — all nonzero residues modulo 7
Rules and sources
calc · prerequisite — Assume exact integer arithmetic, division with remainder, and definitions of divisibility and gcd; every congruence has an explicit modulus. Explicitly assume the complete trial-division-to-square-root primality criterion.
mko_definition · cited — The theorem modulus is an explicit prime p≥2. The coprime form requires p not dividing a; the all-integer form also handles p dividing a without canceling a. Exact modular powers normalize negative bases. Composite examples such as561 show that passing a Fermat test does not prove primality. All residue equalities here have the declared modulo-p scope. · mko-fermat-little-theorem
Main derivation
S01 · implies
Before
p=7,\quad a=-2
After
7\text{ prime},\quad a\equiv5\pmod7,\quad7\nmid a
Conditions: none
Rule: calc · Uses: G1
Leaf basis: calc
A composite 7 would have a prime divisor at most sqrt(7); only 2 is possible and does not divide 7. The base is a unit.
S02 · implies
Before
U_7=\{1,2,3,4,5,6\}
After
5U_7\pmod7=(5,3,1,6,4,2)
Conditions: none
Rule: calc · Uses: G1, S01
Leaf basis: calc
Multiplying every nonzero residue by 5 produces each exactly once, a complete permutation.
S03 · implies
Before
\prod_{u\in U_7}(5u)\equiv\prod_{u\in U_7}u\pmod7
After
5^6\cdot720\equiv720\pmod7,\quad720\equiv6\pmod7
Conditions: none
Rule: calc · Uses: G1, S02
Leaf basis: calc
Permutation preserves the product; factoring out six copies of 5 yields the product to cancel.
S04 · implies
Before
5^6\cdot6\equiv6\pmod7
After
5^6\equiv1\pmod7\Rightarrow(-2)^6\equiv1\pmod7
Conditions: none
Rule: calc · Uses: G1, S01, S03
Leaf basis: calc
Multiply by 6 to cancel a unit and restore the original negative representative.