Zsigmondy's Theorem

Theorem
Let $a > b > 0$ be coprime positive integers.

Let $n \ge 1$ be a (strictly) positive integer.

Then there is a prime number $p$ such that
 * $p$ divides $a^n - b^n$
 * $p$ does not divide $a^k - b^k$ for all $k < n$

with the following exceptions:


 * $n = 1$ and $a - b = 1$
 * $n = 2$ and $a + b$ is a power of $2$
 * $n = 6$, $a = 2$, $b = 1$

Proof
We call a prime number primitive if it divides $a^n-b^n$ but not $a^k-b^k$ for any $k<n$

Let $\Phi_n(x,y)$ denote the $n$th homogeneous cyclotomic polynomial.

By Product of Cyclotomic Polynomials, $a^n-b^n = \displaystyle\prod_{d\mathop\mid n}\Phi_d(a,b)$.

Thus any primitive prime divisor is a divisor of $\Phi_n(a,b)$.

We start by investigating to which extent the converse is true.

Upper bound on nonprimitive prime divisors
Let $p$ be a prime divisor of $\Phi_n(a,b)$ which is not primitive.

Then there exists $k\mid n$ with $k<n$ such that $p\mid a^k-b^k$.

From Product of Cyclotomic Polynomials, $p\mid \frac{a^n-b^n}{a^{d}-b^{d}}$ for all divisors $d<n$ of $n$.

By the Lifting The Exponent Lemma, $p\mid\frac nd$ for $d\mid n$ with $p\mid a^d-b^d$.

In particular, $p\mid n$.

Let $n=p^\alpha q$ with $p\nmid q$.

By Cyclotomic Polynomial of Index times Prime Power, $p\mid \Phi_n(a,b) \mid \Phi_q(a^{p^\alpha}, b^{p^\alpha})$.

By Fermat's Little Theorem, $p\mid \Phi_q(a,b)$.

By Prime Divisors of Cyclotomic Polynomials, $p\equiv1\pmod q$.

Thus $p$ is the largest prime divisor of $n$.

Next, we determine the valuation of $p$ in $\Phi_n(a,b)$.

By Multiplicative Order of Roots of Cyclotomic Polynomial Modulo Prime, if $d\mid n$ with $p\mid a^d-b^d$, then $q\mid d$.

By the Möbius Inversion Formula for Cyclotomic Polynomials:
 * $\Phi_n(a,b) = \displaystyle \prod_{d \mathop \mid n} \left({a^d - b^d}\right)^{\mu \left({n/d}\right)}$.

Taking the valuation:
 * $\nu_p(\Phi_n(a,b)) = \displaystyle\sum_{q\mid d\mid n} \mu(n/d)\cdot\nu_p(a^d-b^d)$.

The only nonzero terms are for $d=n$ and $d=n/p$.

Thus $\nu_p(\Phi_n(a,b)) = \nu_p\left( \dfrac{a^n-b^n}{a^{n/p}-b^{n/p}} \right)$.

By Fermat's Little Theorem, $p\mid a^{n/p}-b^{n/p}$.

If $p>2$, then by the Lifting The Exponent Lemma, $\nu_p(\Phi_n(a,b))=1$.

If $p=2$, then $n$ is a power of $2$.

By Cyclotomic Polynomial of Index Power of Two, $\Phi_n(a,b) = a^{n/2} + b^{n/2}$.

If $n>2$, then by Square Modulo 4, $\Phi_n(a,b)\equiv2\pmod4$.

Thus $\nu_p(\Phi_n(a,b))=1$.

If $n=2$ and $a+b$ is not a power of $2$, then any odd prime divisor of $a+b$ is primitive, and the theorem is true.

We may thus suppose $\nu_p(\Phi_n(a,b))=1$.

Lower bound on primitive prime divisors
If $\Phi_n(a,b)$ has no nonprimitive prime divisors, it suffices to show that $|\Phi_n(a,b)|>1$.

By Trivial Estimate for Cyclotomic Polynomials, $|\Phi_n(a,b)|\geq (a-b)^{\phi(n)}\geq1$ with equality $n=1$ and $a-b=1$.

If $\Phi_n(a,b)$ has a nonprimitive prime divisor $p\mid n$, let $n=p^\alpha q$ with $p\nmid q$.

We have to show that $\Phi_n(a,b) > p$.

If $\alpha>1$, then:

and we're done.

Let $\alpha=1$. Then $n=pq$.

If $a-b>1$ then:

with equality only if $n=1$, in which case the theorem is trivially true.

If $a-b=1$ then:

We have:

so $\Phi_n(a,b)\geq \frac{2^p-1}3$.

If $p\geq5$, then $\frac{2^p-1}3 > p$ and we're done.

Let $p=2$. Then $n=2^\alpha = 2$

Because $a-b=1$, any prime divisor of $a+b$ is then primitive.

Let $p=3$. Then $n=3q$.

From $p\equiv1\pmod q$ we have $n=3$ or $n=6$.

If $n=3$, then $a^n-b^n=a^2+ab+b^2$, and any prime divisor of $a^2+ab+b^2$ is primitive.

If $n=6$, then $\Phi_n(a,b) = a^2-ab+b^2 = b^2+b+1$.

Thus $\Phi_6(a,b)>3$ unless $a=2$ and $b=1$.

Also see

 * Zsigmondy's Theorem for Sums