# Fermat's last theorem: How to (partially) solve by programs

No three distinct positive integers $$a, b, c$$ can satisfy the equation : $$a^n + b^n=c^n$$, if $$n$$ is an integer greater than two.

The above statement, known as the Fermat's last theorem is proven with rigorous mathematics. I happened to stumble on one particular statement:

Proofs were eventually found for all values of $$n$$ up to around $$4$$ million, first by hand, and later by computer.

What I understand is, somehow a computer program assured the theorem was correct upto some value of $$n$$.

Let us simplify and only stick to $$n=3$$ (the smallest possible value of $$n$$). Now my question is, how do I write a program that can ensure that there is no integer solution for $$a,b,c$$? A complete program is not required, rather some discussion (preferably in pseudocode format) would be appreciated.

• Wikipedia has some pointers (under Computational studies). Ultimately this is a question of math, since you cannot verify that there are no solutions for any particular $n$ just using the problem statement. – Yuval Filmus Nov 22 '19 at 14:54

See for example Sophie Germain. Sophie Germain proved that every prime number p with certain properties could be used as an expoonent in Fermat's Last Theorem. She used her theorem to prove that all primes up to 100 would work. Apparently checking her theorem was quite a lot of work because later her theorem was used to check first the primes up to 187 and then up to about 1700. Having a computer and being able to check primes using software would have been very helpful. The "intelligent" work was done by Sophie Germain, a lot more boring work could have very well done by a (then non-existing computer).

Kummer proved an improved theorem, which unfortunately was even harder to verify. There were further improvements made, and this was used to check all primes up to 125,000 and later up to 4,000,000. Checking one prime took about 80 minutes on a 1970's computer - that would have been absolutely impossible to do by hand.

So there is a combination: Mathematicians find a way to decide for certain primes p that $$a^p + b^p \neq c^p$$ for all $$a, b, c \geq 1$$. The actual method to decide is too much work for a human to do in any reasonable time, so a computer comes very useful.

Wiles' theorem was completely different, all done by hand. However, if you follow the discussion at Wikipedia, you'll find there was mathematics beyond the reach of most mortals, based on more mathematics beyond the reach of most mortals, etc. quite a few levels deep.

First of all, it is well-known that it suffices to consider odd prime $$n$$

Kummer showed that if $$p$$ doesn't divide the numerators of any of the Bernoulli numbers $$B_2,B_4,\ldots, B_{p-3}$$ then Fermat's last theorem holds for $$n = p$$. Such primes are called regular. Vandiver gave a criterion which handles irregular primes. The criterion is a bit complicated, and is stated in Section 4 of Wagstaff, The irregular primes to 125000.

The criterion requires one to provide an integer $$t$$ which satisfies some property. Wagstaff states that in practice $$t = 2$$ always works, but a priori we are not guaranteed that any value of $$t$$ works; and even if no value of $$t$$ works, that doesn't imply that Fermat's last theorem holds. So the criterion is sufficient but not known to be necessary, and furthermore, event a good $$t$$ exists, it's not clear how to find it. However, as stated above, in practice $$t = 2$$ always works.

The work you're describing, proving Fermat's last theorem for larger primes, likely uses the same framework. You can consult Buhler, Crandall, Ernvall and Metsänkylä, Irregular primes and cyclotomic fields to four million.