The equation x to the n plus y to the n equals z to the n has no solutions in integers for any n greater than 2. For Mars Last Theorem, as this became known, would go unproven for 358 years, in fact, to solve it, new numbers had to be invented. For example, find three squares whose areas add to create a bigger square. And the area of the first square is the side length of the second square. And the area of the second square is the side length of the third square. So if we set the side of the first square to be x, then its area is x squared. This is the side length of the second square, which therefore has an area of x to the 4. This is then the side length of the third square, which has an area of x to the 8. And we want these three areas, x squared plus x to the 4+ x to the 8 to add to make a new square. So let’s call its area y squared.

Now it’s not hard to find solutions to this equation in the real numbers. For example, set x equal to 1, and you find y is root 3. But Diaphantas wasn’t interested in real solutions. He wanted rational solutions that are whole numbers or fractions. In the late 1800s, a mathematician named Kurt Hensel try to find solutions to equations like this one in the form of an expansion of increasing powers of primes. So working with the prime 3, the solutions would take the form of x equals x not plus x 1*3 plus x 2*3 squared plus x 3*3 cubed and so on. And y would also be a similar expansion in powers of 3. Each of the coefficients would be either 0,1 or 2. Now imagine inserting these expressions into our equation for x and y. And you can see it’s going to get messy real fast. But there is a way to simplify things. Say you wanted to write 17 in base 3. Well, one way to do it is to divide 17 by 3 and find the remainder, which in this case is 2. So we know the units digit of our base 3 number is 2. Next, divide 17 by 9, the next higher power of 3, and you get a remainder of 8. Subtract off the 2 we found before, and you have 6, which is 2*3. So we know the second to last digit is 2. Next, divide 17 by 27 and you get a remainder of 17. Subtract off the 8 we’ve already accounted for and you have 9. So the ninth digit is 1. So 17 in base 3 is 1,2,2.

What’s great about this approach is it allows us to work out the coefficients in our expansion one at a time by first solving the equation mod 3 and then mod 9 and then mod 27 and so on. So first let’s try to solve the equation mod 3. And since all the higher terms are divisible by 3, they are all 0 if we’re working mod 3. So we’re left with x not squared plus x not to the fourth plus x not to the 8 equals y knot squared. And this will allow us to find the values of x knot and y knot that satisfy the equation mod 3.

Now we shouldn’t be surprised to find 0,0 as a solution since x equals 0 and y equals 0 does satisfy the equation, but squares of zero size don’t really count as solutions to Diaphus’s geometric problem. So let’s try to expand on one of the other solutions. Let’s find one more term of the expansion by solving the equation mod 27. Again, all the terms with three rays to the power of 3 or higher contain a factor of 27. So they’re zero, leaving only this expression. But we know x not and x 1 are equal to 1. So we can simplify to this expanding again, we get 16+18 x 2+81 x squared, but 81 is 27*3, so that’s zero. The next term is the square of the first so 256 plus 576 x 2+324 x 2 squared but 300 twenty four is 27*12. So that’s zero. And since we’re working Mod 27, we can simplify this down. 576 is nine more than a multiple of 27 and 256 is 13 more than a multiple of 27. So we’re left with 13+9 x 2. And the last term is just that squared the right hand side reduces to 0+81 y squared, which is again 0. So we have 36+45 x 2=0, which mod 27 is the same as 9+18 x 2=0. So x 2 must be equal to 1. 9+18 is 27, which mod 27 is 0.

So what we’ve discovered is the first three coefficients in our expansion are all one. And in fact, if you kept going with modulus 81,243 and so on, you would find that all of the coefficients are 1. So the number that solves Diaphus’s equation about the squares is actually a 3 addict number where all the digits are ones.