linguistic:voice_change, stylistic:tone, information:highlighting
Subsequent developments and solution

The special case n = 4, proved by Fermat himself, is sufficient to establish that if the theorem is false for some exponent n that is not a prime number, it must also be false for some smaller n, so only prime values of n need further investigation. Over the next two centuries (1637–1839), the conjecture was proved for only the primes 3, 5, and 7, although Sophie Germain innovated and proved an approach that was relevant to an entire class of primes. In the mid-19th century, Ernst Kummer extended this and proved the theorem for all regular primes, leaving irregular primes to be analyzed individually. Building on Kummer's work and using sophisticated computer studies, other mathematicians were able to extend the proof to cover all prime exponents up to four million, but a proof for all exponents was inaccessible (meaning that mathematicians generally considered a proof impossible, exceedingly difficult, or unachievable with current knowledge).

Separately, around 1955, Japanese mathematicians Goro Shimura and Yutaka Taniyama suspected a link might exist between elliptic curves and modular forms, two completely different areas of mathematics. Known at the time as the Taniyama–Shimura conjecture (eventually as the modularity theorem), it stood on its own, with no apparent connection to Fermat's Last Theorem. It was widely seen as significant and important in its own right, but was (like Fermat's theorem) widely considered completely inaccessible to proof.

In 1984, Gerhard Frey noticed an apparent link between these two previously unrelated and unsolved problems. An outline suggesting this could be proved was given by Frey. The full proof that the two problems were closely linked was accomplished in 1986 by Ken Ribet, building on a partial proof by Jean-Pierre Serre, who proved all but one part known as the "epsilon conjecture" (see: Ribet's Theorem and Frey curve). These papers by Frey, Serre and Ribet showed that if the Taniyama–Shimura conjecture could be proven for at least the semi-stable class of elliptic curves, a proof of Fermat's Last Theorem would also follow automatically. The connection is described below: any solution that could contradict Fermat's Last Theorem could also be used to contradict the Taniyama–Shimura conjecture. So if the modularity theorem were found to be true, then by definition no solution contradicting Fermat's Last Theorem could exist, which would therefore have to be true as well.

Although both problems were daunting and widely considered to be "completely inaccessible" to proof at the time, this was the first suggestion of a route by which Fermat's Last Theorem could be extended and proved for all numbers, not just some numbers. Unlike Fermat's Last Theorem, the Taniyama–Shimura conjecture was a major active research area and viewed as more within reach of contemporary mathematics. However, general opinion was that this simply showed the impracticality of proving the Taniyama–Shimura conjecture. Mathematician John Coates ' quoted reaction was a common one:

I myself was very sceptical that the beautiful link between Fermat's Last Theorem and the Taniyama–Shimura conjecture would actually lead to anything, because I must confess I did not think that the Taniyama–Shimura conjecture was accessible to proof. Beautiful though this problem was, it seemed impossible to actually prove. I must confess I thought I probably wouldn't see it proved in my lifetime.

On hearing that Ribet had proven Frey's link to be correct, English mathematician Andrew Wiles, who had a childhood fascination with Fermat's Last Theorem and had a background of working with elliptic curves and related fields, decided to try to prove the Taniyama–Shimura conjecture as a way to prove Fermat's Last Theorem. In 1993, after six years of working secretly on the problem, Wiles succeeded in proving enough of the conjecture to prove Fermat's Last Theorem. Wiles's paper was massive in size and scope. A flaw was discovered in one part of his original paper during peer review and required a further year and collaboration with a past student, Richard Taylor, to resolve. As a result, the final proof in 1995 was accompanied by a smaller joint paper showing that the fixed steps were valid. Wiles's achievement was reported widely in the popular press, and was popularized in books and television programs. The remaining parts of the Taniyama–Shimura–Weil conjecture, now proven and known as the modularity theorem, were subsequently proved by other mathematicians, who built on Wiles's work between 1996 and 2001. For his proof, Wiles was honoured and received numerous awards, including the 2016 Abel Prize.