Source: Original.
7 2 9 5 3 1 6 4 8
I found a total of 38 solutions to this part, including some solutions using every possible set of 6 or 7 lines adding to a common sum that doesn't cause an immediate contradiction. Every digit appears in the middle in some solution, but only 12, 15, and 18 seem to be allowed as common sums. The possible sets of magic lines are limited, as follows: If all three rows add up to the common sum, then either all three columns do, or at most one column does, since the sum of the rows and the sum of the columns is the same. A. One possibility is that all the rows and columns add up to the common sum, but neither diagonal does (or, alternately, one diagonal does). Several forms of this can be found as wraparound-rotations of the standard 3x3 magic square: Standard magic square: 8 3 4 1 5 9 6 7 2 Wrapped H or V: 6 7 2 1 5 9 3 4 8 4 8 3 8 3 4 6 7 2 5 9 1 9 1 5 1 5 9 8 3 4 7 2 6 2 6 7 Wrapped H and V (in these cases, one diagonal adds to 15): 5 9 1 7 2 6 2 6 7 9 1 5 7 2 6 3 4 8 4 8 3 2 6 7 3 4 8 5 9 1 9 1 5 4 8 3 Note that this gives one square for each center digit. This includes all squares of this type. Proof: Since the sum of all the digits is 45, and the three rows use each digit once, the sum of each row and column must be 15. There are only two pairs of numbers that can be in the same row with 9: 1 and 5, or 2 and 4. Likewise, 1 can only be in a row with 9 and 5, or 8 and 6. So, one row (or column, but ignoring rotations, put this into a row) has to have 1, 9, and 5 in it in some order. The column with 9 must have 2 and 4, and the column with 1 must have 6 and 8. So, the column with 5 has 7 and 3 in it. Now, if 8 is in the same row with 2, the other number in that row must be 5, so this cannot be. 8 must be in the row with 4 (and 3), and 2 must be in the row with 6 (and 7). Thus, the rows and columns of any such square must be the same as the rows and columns of the standard 3x3 magic square, but possible out of order, permuted, etc. Also note that to keep the sums consistent, having the entries in a row permuted requires that the columns are rearranged in the order of that permutation, so all the rows will have their entries permuted the same way, so we can just consider the reorderings of the rows and columns. Ignoring reflections, there are just 3 ways to arrange the 3 rows and 3 ways to arrange the columns. Any of these row orders can go with any of the column orders, and this gives the 9 squares above. B. Since you can't have just one orthogonal line not add to the common sum, in all other cases, both diagonals add to the common sum, as do 4 of the other lines. Ignoring rotations and reflections, five possible cases result from this: B1: Two opposite edge lines don't add to the common sum B2: Two adjoining edge lines don't add to common sum B3: One edge line and one center line, in the same direction, don't add to the common sum B4: One edge line and one center line, in different directions, don't add to the common sum B5: The two center lines don't add to the common sum. There are solutions for every one of these cases! In cases B1 and B3, three lines in the same direction add to the common sum, and those three lines contain all the numbers and thus add to 45, so the common sum can only be 15. In cases B1 and B2, all four lines through the center number add up to the common sum. If we add these up, using the terminology of part 1, 4M = sum(1..9) + 3X. The only answers that work are X = 1, 5, 9, which make M respectively 12, 15, 18. It happens that you can pair up the remaining numbers to give four sums of M through the center in each of these cases, so there's no problem yet, although the reasoning above limits us to X=5 in case B1. Case B1. Let's make the outer columns the ones that don't add up. We know the common sum is 15 and the center number is 5. Now all the other numbers pair up into groups that must go on opposite sides of 5. 1-9 must go somewhere. Suppose it goes across the middle. Then 8-2 must go into the top and bottom rows. 8 is too large to go together with any of the other numbers greater than 5, so it goes with 3 and 4. similarly, 2 goes with 6 and 7. This is all we needed for this case. However, we have some freedom left. We can arrange those numbers in the top row in any order. The numbers in the bottom row are then forced into place. The numbers in the middle row are still free to be swapped. However, swapping these and the upper corners just flips the thing over. To avoid reflections, keep 8-3-4 on top, and 1-5-9 in that order in the middle. If the top is in 8-3-4 order, we get the standard magic square; for the 5 other arrangements, we get these solutions: 8 4 3 3 8 4 3 4 8 4 8 3 4 3 8 1 5 9 1 5 9 1 5 9 1 5 9 1 5 9 7 6 2 6 2 7 2 6 7 7 2 6 2 7 6 Now, suppose 9-1 is not in the middle. Then 9 can only go with 2 and 4 to make a solution; 1 goes with 6 and 8. 3 and 7 are left across the middle. Again we have the freedom of putting the top digits in any order. This time, put 6-1-8 in the top, and 7-5-3 across the middle in that order. If the top is in the order 6-1-8, we get the standard magic square, and for the other 5 arrangements we get these solutions: 6 8 1 1 6 8 1 8 6 8 6 1 8 1 6 7 5 3 7 5 3 7 5 3 7 5 3 7 5 3 9 2 4 2 4 9 4 2 9 9 4 2 4 9 2 Since 9-1 either has to be in the middle or not in the middle, these are all the solutions for this case. Case B2. Make the right column and bottom row the ones that don't add up. With this combination of rows, there will be no rotations and only one reflection of each answer to worry about. The center number is 1, 5, or 9, corresponding to common sums of 12, 15, and 18, and the remaining numbers in each case have to exist in specific pairs on opposite sides of the center. There are many ways to arrange the pairs for each center number, and some of them work: If 1 is in the center, the sum of all six rows is 72, and this sum contains every number at least once, but the upper left number is included three times, the center number (1) 4 times, and the other numbers at the top or left twice each. After subtracting the center, this leaves us with: 68 = sum(2..9) + sum(2..9) + upper left - (3 numbers in lower right) sum(2..9) = 44, so this says 3 numbers in lower right = 20 + upper left. The largest possible sum of 3 numbers in the lower right is 24, so the number in the upper left is 2, 3, or 4. If it's 2, 9 goes opposite it, and the other numbers at the top are a pair that adds to 10, 3-7 or 4-6, and the other numbers on the left are the other of these pairs. Out of these four numbers, one pair must go along the diagonal with 1, and so the pair has to add to 11, and that can be only 7 and 4. This leaves just one way fill in the square, ignoring reflections: 2 3 7 6 1 5 4 8 9 If 3 is in the upper left, 8 is opposite it, and the other pairs at the top and left add to 9: 2-7 and 4-5. Again 7-4 go on the other diagonal, and we get: 3 2 7 5 1 6 4 9 8 If 4 is in the upper left, 7 is opposite it, and the other pairs at top and left add to 8: 3-5 and 2-6. 5-6 goes on the other diagonal: 4 3 5 2 1 9 6 8 7 If 9 is in the middle, all the same calculations work as their tens-complements, (that is, swap each number with 10 minus itself) and we get the tens-complements of these three answers: 8 7 3 7 8 3 6 7 5 4 9 5 5 9 4 8 9 1 6 2 1 6 1 2 4 2 3 If 5 is in the middle, the common sum is 15, and since 2 rows add to 15, the remaining three numbers in the other row add to 15, so we have only the standard magic square in this case. Case B3. Let the middle and right columns be the ones that don't add up. We know the common sum is 15. It looks like 2, 4, 6, or 8 could go in the middle instead of 5, and still have three pairs of numbers to go opposite them; in the case of 4, these are 2-9, 3-8, and 5-6; for 2, they are 6-7, 5-8, and 4-9; for 6 and 8, take the tens-complements. There are two other squares that have three lines going through them, the upper left and lower left corners; these must also come from the set 2, 4, 5, 6, 8. The numbers 1, 3, 7, and 9 must go into four of the other six spaces. For each center number besides 5, two of these four do not appear in the three lines through the center digit which add to the common sum, and therefore must go in the middle column. If 5 is in the center, the leftover pair of numbers that goes in the center column with it cause that column to add to 15 also, so we end up with the standard magic square. For 2 in the middle, the only way to get 15 in the left column is to put 4, 5, 6 there, and 1 and 3 need to go in the middle column so, ignoring reflections, we want the top corners to add to 14 and the bottom corners to add to 12. This happens for these two cases: 6 1 8 5 1 9 4 2 9 6 2 7 5 3 7 4 3 8 For 4 in the middle, if we don't have either 8 or 9 on the left, the left column will add up to less than 15; both of them is too much, so we have one or the other of them. But there's no pair available to match with 9 to add to 15 so we must have 8-2-5 on the left in some order. Then 1 and 7 go in the middle column, so we need, say, top corners adding to 14, bottom corners to 8. This yields two solutions: 5 1 9 8 1 6 8 4 3 2 4 9 2 7 6 5 7 3 For 6 or 8 in the middle, we get four more solutions that are the tens-complements of these: 4 9 2 5 9 1 5 9 1 2 9 4 6 8 1 4 8 3 2 6 7 8 6 1 5 7 3 6 7 2 8 3 4 5 3 7 Case B4: Let the middle column and bottom row be the ones that don't add up. Take the sum of the two diagonals and the middle row, and subtract the left and right columns. The result is the common sum, and it must equal three times the center number. Also note that three lines go through the center number, each of which must add to three times the center number; this only works for 4, 5, and 6. If 5 is in the center, the last line through the center also adds to 15, so all the columns and 2 rows add to 15, so the last row does as well, and we only have the standard magic square. For 4 in the center, 8 and 9 must go in the middle column. If 9 goes on top, 1 and 2 must go beside it; if 8 is on top, 1 and 3 must go beside it. These entries force all the other numbers, ignoring reflections, as follows: 1 9 2 1 8 3 5 4 3 6 4 2 6 8 7 5 9 7 For 6 in the center, we get the tens-complements of the above answers: 9 1 8 9 2 7 5 6 7 4 6 8 4 2 3 5 1 3 Case B5. In part 1 I considered the case of having the two center lines not add to the common sum. If we remove the restriction that the common sum be greater than 15, we have the five cases in the table from part 1, but X=1 and X=9 have no way to achieve the specified sums. X=7 gives the tens-complement of the square from part 1: 1 8 3 9 7 5 2 6 4 X=5 results only in the standard magic square. The diagonals must contain 2 of the following 4 sets of numbers: 1-5-9, 2-5-8, 3-5-7, 4-5-6. If 1-5-9 is in a diagonal, then no matter what you put on the other diagonal, one outer edge row will need at least a 10 to add to 15. If you put 2-5-8 on a diagonal, 4-5-6 must go on the other to avoid needing a 10; then the standard 3x3 magic square is forced. If you put 3-5-7 and 4-5-6 on the diagonals, repeats of 4 and 6 are forced within the square. Summary of part 2: Type Number of solutions A 8 B1 10 B2 6 B3 8 B4 4 B5 2 total 38 Joseph DeVincentis