# Rough estimate

Of the 25 digits in a 5x5 square, one is given (in the top left-hand corner), roughly 12 can be derived from the other 13 becuase 12 digit sums are known (however, read on), 9 are odd, 9 are non-zero (including the top left-hand digit and two non-zero digits at the ends of the /-diagonal). Therefore, we arrive at an estimate of 9^6*10^6/2^9 candidate squares.This is a rough estimate because the digit sums of 5 rows, 5 columns, and 2 diagonals do not predetermine exactly 12 digits given the other 13. The 12 prescribed digit sums can be viewed as yielding 12 linear equations for 25 unknowns, of which 12 unknowns might indeed be expressed in terms of the remaining 13 unknowns. In this particular case, however, the 12 equations are not linearly independent.

It is obvious that if at least one horizontal digit sum is incorrect, then also at least one vertical digit sum must be incorrect (because the total digit sum of the whole square is obtained both as the sum of all row sums and as the sum of all column sums). Thus, it is impossible to have a mistaken digit sum in exactly one of the rows or columns. Hence, one of the row or column equations is superfluous and can be dropped. The remaining 11 digit sums do allow one to determine 11 digits from the others (when appropriately chosen; try this yourself first).

Here is a way to do it. Let us name the digits as follows:

a b c d e f g h i j k l m n p q r s t u v w x y zFor instance, these 11 digits

. . . . e . . . . j . . m . p . . s t u v w x y .can be computed from the others as follows:

e = digit sum - (a + b + c + d) j = digit sum - (f + g + h + i) v = digit sum - (a + f + k + q) w = digit sum - (b + g + l + r) m = digit sum - (v + r + i + e) p = digit sum - (k + l + m + n) t = digit sum - (a + g + m + z) u = digit sum - (e + j + p + z) s = digit sum - (q + r + t + u) x = digit sum - (c + h + m + s) y = digit sum - (v + w + x + z)Therefore, the estimate should be increased to 9^6*10^7/2^9, or approx. 10^10.

Note that it is possible that the digit sums of all rows, all columns, and only one diagonal are correct. Here is an example (do you see the structure in it?):

1 9 3 9 1 1 1 9 3 9 9 1 1 9 3 3 9 1 1 9 9 3 9 1 1The digit sums of all rows, all columns, and the /-diagonal equal 23. The digit sum of the \-diagonal equals 5. By the way, all rows, all columns, and the /-diagonal are primes. Find an example where also the \-diagonal is a prime (with a digit sum differing from the others).