Pierre de Fermat (1601-1665) was a lawyer and amateur mathematician. In about 1637, he annotated his copy (now lost) of Bachet's translation of Diophantus' Arithmetika with the following statement:
Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et generaliter nullam in infinitum ultra quadratum potestatem in duos ejusdem nominis fas est dividere: cujus rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet.In English, and using modern terminology, the paragraph above reads as:
There are no positive integers such that x^n + y^n = z^n for n>2. I've found a remarkable proof of this fact, but there is not enough space in the margin [of the book] to write it.Fermat never published a proof of this statement. It became to be known as Fermat's Last Theorem (FLT) not because it was his last piece of work, but because it is the last remaining statement in the post-humous list of Fermat's works that needed to be proven or independently verified. All others have either been shown to be true or disproven long ago.
Theorem 1 [Fermat's Last Theorem] There are no positive integers x, y, z, and n > 2 such that x^n + y^n = z^n.
Andrew Wiles, a researcher at Princeton, claims to have found a proof. The proof was presented in Cambridge, UK during a three day seminar to an audience which included some of the leading experts in the field. The proof was found to be wanting. In summer 1994, Prof. Wiles acknowledged that a gap existed. On October 25th, 1994, Prof. Andrew Wiles released two preprints, Modular elliptic curves and Fermat's Last Theorem, by Andrew Wiles, and Ring theoretic properties of certain Hecke algebras, by Richard Taylor and Andrew Wiles. The first one (long) announces a proof of, among other things, Fermat's Last Theorem, relying on the second one (short) for one crucial step.
The argument described by Wiles in his Cambridge lectures had a serious gap, namely the construction of an Euler system. After trying unsuccessfully to repair that construction, Wiles went back to a different approach he had tried earlier but abandoned in favor of the Euler system idea. He was able to complete his proof, under the hypothesis that certain Hecke algebras are local complete intersections. This and the rest of the ideas described in Wiles' Cambridge lectures are written up in the first manuscript. Jointly, Taylor and Wiles establish the necessary property of the Hecke algebras in the second paper.
The new approach turns out to be significantly simpler and shorter than the original one, because of the removal of the Euler system. (In fact, after seeing these manuscripts Faltings has apparently come up with a further significant simplification of that part of the argument.)
The papers were published in the May 1995 issue of Annals of Mathematics. For single copies of the issues send e-mail to email@example.com for further directions.
Both manuscripts have been published. Thousands of people have a read them. About a hundred understand it very well. Faltings has simplified the argument already. Diamond has generalized it. People can read it. The immensely complicated geometry has mostly been replaced by simpler algebra. The proof is now generally accepted. There was a gap in this second proof as well, but it has been filled since October 1994.
A related conjecture from Euler
x^n + y^n + z^n = c^n has no solution if n is >= 4
Noam Elkies gave a counterexample, namely 2682440^4 + 15365639^4 + 18796760^4 = 20615673^4. Subsequently, Roger Frye found the absolutely smallest solution by (more or less) brute force: it is 95800^4 + 217519^4 + 414560^4 = 422481^4. "Several years", Math. Comp. 51 (1988) 825-835.
This synopsis is quite brief. A full survey would run too many pages.
 J.P.Butler, R.E.Crandall,& R.W.Sompolski, Irregular Primes to One Million. Math. Comp., 59 (October 1992) pp. 717-722.
Fermat's Last Theorem, A Genetic Introduction to Algebraic Number Theory. H.M. Edwards. Springer Verlag, New York, 1977.
Thirteen Lectures on Fermat's Last Theorem. P. Ribenboim. Springer Verlag, New York, 1979.
Number Theory Related to Fermat's Last Theorem. Neal Koblitz, editor. Birkhäuser Boston, Inc., 1982, ISBN 3-7643-3104-6
No he did not. Fermat claimed to have found a proof of the theorem at an early stage in his career. Much later he spent time and effort proving the cases n=4 and n=5. Had he had a proof to his theorem earlier, there would have been no need for him to study specific cases.
Fermat may have had one of the following ``proofs'' in mind when he wrote his famous comment.
The incorrect proof goes something like this:
We only need to consider prime exponents (this is true). So consider x^p + y^p = z^p. Let r be a primitive p-th root of unity (complex number)
Then the equation is the same as:
(x + y)(x + ry)(x + r^2y)...(x + r^(p - 1)y) = z^p
Now consider the ring of the form:
a_1 + a_2 r + a_3 r^2 + ... + a_(p - 1) r^(p - 1)
where each a_i is an integer
Now if this ring is a unique factorization ring (UFR), then it is true that each of the above factors is relatively prime.
From this it can be proven that each factor is a pth power from which FLT follows. This is usually done by considering two cases, the first where p divides none of x, y, z; the second where p divides some of x, y, z. For the first case, if x + yr = u*t^p, where u is a unit in Z[r] and t is in Z[r], it follows that x = y (mod p). Writing the original equation as x^p + (-z)^p = (-y)^p, it follows in a similar fashion that x = -z (mod p). Thus 2*x^p = x^p + y^p = z^p = -x^p (mod p) which implies 3*x^p = 0 (modp) and from there p divides one of x or 3|x. But p>3 and p does not divides x; contradiction. The second case is harder.
The problem is that the above ring is not an UFR in general.
Another argument for the belief that Fermat had no proof ---and, furthermore, that he knew that he had no proof--- is that the only place he ever mentioned the result was in that marginal comment in Bachet's Diophantus. If he really thought he had a proof, he would have announced the result publicly, or challenged some English mathematician to prove it. It is likely that he found the flaw in his own proof before he had a chance to announce the result, and never bothered to erase the marginal comment because it never occurred to him that anyone would see it there.
Some other famous mathematicians have speculated on this question. Andre Weil, writes:
Only on one ill-fated occasion did Fermat ever mention a curve of higher genus x^n + y^n = z^n, and then hardly remains any doubt that this was due to some misapprehension on his part [...] for a brief moment perhaps [...] he must have deluded himself into thinking he had the principle of a general proof.
Winfried Scharlau and Hans Opolka report:
Whether Fermat knew a proof or not has been the subject of many speculations. The truth seems obvious ... [Fermat's marginal note] was made at the time of his first letters concerning number theory ... as far as we know he never repeated his general remark, but repeatedly made the statement for the cases n=3 and 4 and posed these cases as problems to his correspondents [...] he formulated the case n=3 in a letter to Carcavi in 1659 [...] All these facts indicate that Fermat quickly became aware of the incompleteness of the [general] ``proof" of 1637. Of course, there was no reason for a public retraction of his privately made conjecture.
However it is important to keep in mind that Fermat's ``proof" predates the Publish or Perish period of scientific research in which we are still living.
From Fermat to Minkowski: lectures on the theory of numbers and its historical development. Winfried Scharlau, Hans Opolka. New York, Springer, 1985.
Basic Number Theory. Andre Weil. Berlin, Springer, 1967