Fallacy in Fermat's Little Theorem? Fermat's Little Theorem: If $p$ is prime, then for every $1 ≤ a &lt p$,
$a^{p-1} ≡ 1$ $(mod$ $p)$
Let $p$ be 9 (a composite number), and let $a$ be 2. 
Let $S$ be the nonzero integers modulo $9$
$S = (1, 2, 3, 4, 5, 6, 7, 8)(mod$ $9)$
$2^8S$
$=2^8(1, 2, 3, 4, 5, 6, 7, 8)$$=
(1*2,2*2,3*2,4*2,5*2,6*2,7*2,8*2)$
$= (2, 4, 6,8,10,12,14,16)$$
 = (1,2,3,4,5,6,7,8)(mod$ $9$)
∴ $8! = 2^8*8!$
Divide both sides by $8!$ and you arrive at:
$2^8 ≡ 1$ $(mod$ $9)$
Doesn't Fermat's Little Theorem only apply when $p$ is a prime number? The above calculations showed when $p = 9$ (composite),  $a = 2$ still fulfills the equation.

i) No see Fermat pseudoprime.
ii) $2^8=256$ and $2+5+6=13$ so that $2^8= 1+3 \pmod{9}$ (the other one is right)
$2^{340} = 1\pmod{341}$ and $341=11\cdot 31$
