The puzzle marked 30 years since completion of the proof of Fermat’s Last Theorem, by Andrew Wiles.
This is one possible solving path. The clues not included in the grid’s perimeter are the first six, which must therefore be true (ie, with an error of 0), and the last seven, whose errors must be > 26. The only letters used for exponents in the clues are {c, h, i, p, q} and the preamble tells us their values are all < 6. To make the first six clues true, their exponents h and i must be 1 and 2 in some order, because Fermat’s Last Theorem tells us such equations exist only for exponents ≤ 2. For clue 31ac, ki + ni = (k + n)i can be true only if i = 1 (since k and n are > 0), which makes h = 2. Then 30dn ch + ph = qh (with the first two terms in ascending order) must be 32 + 42 = 52, so c = 3, p = 4, q = 5 and 30dn = 25.
That also makes 7ac = 17, with the right-hand side of 25 having an error of 8, and 14ac = 68, with the right-hand side d2 as yet unknown. Its error must be ≥ 8 and ≤ 26 (because the preamble tells us only the last seven clues have a larger error), so d2 is either in the range [68 − 26 = 42, 68 − 8 = 60] or in [68 + 8 = 72, 68 + 26 = 94], ie it’s one of {49, 81} with d in {7, 9} and an error of {18, 13} respectively.
The last clue, 19ac, is now (k4 − 2k − 2n)2 + (k4 + 253)2 = (2e3 + 3)2, for a seven-digit answer. If k is 7 then the minimum value is (74 − 2×7 − 2×8)2 + (74 + 253)2 = 12665357, too big, so k = 6 and the expression for the answer reduces to (1284 − 2n)2 + 2399401. For 1ac we have (6 + n)5 + (g − o)5 for a seven-digit answer, so n < 99999991/5 − 6 ≈ 19.1 and 31ac = 6 + n is in the range [13, 25]. That means 24dn = 53 + (m − t)3 ends in 1 or 2, so (m − t)3 must end in 6 or 7, ie (m − t) ends in 6 or 3, and it’s > 5 because of the ordering of the terms in the clue. If (m − t) is 13 we get 53 + 133 = 2322, too big for 24dn, so (m − t) must be 6 and 24dn = 341 = 53 + 63, so 31ac is reduced to the range [13, 19] with n in [7, 13] correspondingly.
19ac = (1284 − 2n)2 + 2399401 is at least (1284 − 2×13)2 + 2399401 = 3981965 and at most (1284 − 2×7)2 + 2399401 = 4012301, so 15dn matches 83_ or 84_. But 15dn = (l + z)2 (with no error) is a square and the only square in the range is 15dn = 841 with (l + z) = 29. That makes 19ac at least 4010000 (because 20dn can’t start with 0), so the maximum for n is (1284 − √(4010000 − 2399401))/2 ≈ 7.5, ie n = 7, 19ac = 4012301 and 31ac = 13. The two squares that add to 841 for 15ac must end in (0 and 1) or (5 and 6) to give a sum ending in 1, so the square roots end in some of {0, 1, 4, 5, 6, 9}; the smaller square root is between √(841 − 262) ≈ 12.8 and √(841/2) ≈ 20.5, ie f is one of {14, 15, 16, 19, 20}. The only one that gives an integer for √(841 − f2) is f = 20 with m = 21. That makes 2dn = 400 (because the equation has no error in the right-hand side).
Now d can’t be 7, so d = 9, which makes 5dn = 85 and the error for 14ac is 92 − 68 = 13. The clue for 9ac is now 169 + (x + 1)2 = 841, with an error ≤ 8 (the error for 7ac), so x is between √(841 − 8 − 169) − 1 ≈ 24.8 and √(841 + 8 − 169) − 1 ≈ 25.1, ie x = 25 and 9ac = 845 with an error of 4.
For 24dn = 125 + (21 − t)3 the grid entry ends in 1, so (21 − t)3 ends in 6 and t ends in 5; 5 and 25 have been taken already, so t = 15 and 24dn = 341. The right-hand side is (25 − l)3, with an error ≤ 8 and the only cube within 8 of 341 is 73 = 343, so l = 18 and the error in 24dn is 2. 11ac is now 113 + 143 = 163, so 11ac = 4075, the right-hand side is 4096 and the error is 21. Now 15dn gives (18 + z)2 = 841 (exactly), so z = 11, which makes 20dn = 1729, 1dn = 124625 and 13dn = 6401026, and the right-hand side for 8dn is 729, with an error of 1.
We have 8dn = 66 + (y − 18)3 to match 7__ in the grid, so y ≥ (700 − 216)1/3 + 18 ≈ 25.8, ie y = 26 and 8dn = 728, which makes 10ac = 1762 and 3dn = 1874097.
The 6dn clue is (v − a)2 + 81 = e2 and to match _7 in the grid it must be at least 87; but 87 − 81 = 6 isn’t a square, so 6dn = 97 with (v − a)2 = 16. The error is in the range [2, 4] and the only square within 4 of 97 is 100, so e = 10 and the error for 6dn is 3. That makes 17dn = 212 and establishes errors for 17dn, 5dn and 19ac of 13, 15 and 292 respectively. The order of terms in the clue for 7dn requires o < e and the only unassigned value below 10 is o = 8, which makes 7dn = 164.
Clue 25dn is r2 + v2 = 212 (with an error in the range [8, 13]); specifically, v < 21. Clue 3dn is 214 + 364 = (20 + v)4 (with a large error), so we need 20 + v > 36, ie v > 16. The only available values between 16 and 21 are {17, 19}; but we know that a = v − 4 and 19 − 4 = 15 is taken by t, so v = 17 and a = 13, which makes 29dn = 41, 27dn = 233 (with the right-hand side of 289 having an error of 56) and the right-hand side of 3dn being 1874161 with an error of 64.
Clue 2dn gives (g − 12)2 + 162 = 202 (exactly), so g = 24, which makes 26ac = 3025, 23ac = 26 (with an error of 10) and 1ac = 1419869. The right-hand side for clue 20dn is (24 − r)3, a cube that has to be within 2 of the answer 1729, namely 123 = 1728, so r = 12, which makes 25dn = 433. That completes 28ac = 4349 in the grid, which has to equal (20 + j)2 + 502, and √(4349 − 2500) − 20 gives j = 23, which makes 4dn = 9457, 25ac = 4724 and 32ac = 1157632.
For 12ac the clue is (26 + u)2 + 422 = 582 (exactly), so u = 14, which makes 22dn = 5337, 18dn = 456552 and 30ac = 232. For 10dn we have (s − 9)3 + 103 = 113 with an error of 12 or 13; to have s − 9 < 10, the only available value is s = 16, making 10dn = 1343 (with an error of 12).
For 16ac we have (4b)2 + 2002 to fit 47_44 in the grid, so b is between √(47044 − 40000)/4 ≈ 20.98 and √(47944 − 40000)/4 ≈ 22.3. Of {21, 22}, only 22 is still available, so b = 22, making 16ac = 47744 and 12dn = 37234. That leaves only w = 19 and the clue for 21ac becomes 233 + 443, which matches 21ac = 97351 that we have in the grid.
Finally, filling in the letters for the clues’ error values from 1 to 24, the perimeter spells “this margin is too narrow to contain the proof”, something Pierre de Fermat wrote beside his statement of the theorem in about 1637. The theorem remained unproved until Andrew Wiles completed his proof in 1994, 30 years ago.