Kindayr said:
Either p|(a^{m}+1) or p|(a^{m}-1). If it is the latter, then p|(a^{m}-1) implies that a^{m}\equiv 1\mod p, but that would mean that the order of a is m, which contradicts the fact that a is a generator of \mathbb{Z}_{p}^{\times}. Hence, it must be that a^{m}\equiv -1\mod p.
well, you know, that's ok, but the thing is, we don't really care which factor p divides, so long as we know that p divides one of them. the point is:
k = (a
m - 1)(a
m + 1)/p
we're trying to prove something about k, here: gcd(k,p) = 1.
could k be 0? well, that would mean one of our factors is 0, but surely a > 1.
and if 1 ≤ k < p, as you yourself already noted, gcd(k,p) = 1.
so if k ≥ p, the only way gcd(k,p) ≠ 1, is if p|k.
and that's what we want to show "can't happen".
now, for ANY positive integer n, and any ODD prime, can p divide both n and n+2?