Take 9 numbers from 1~20 without repetition and fill them in a 3x3 grid so that the sums on each row, each column, and each diagonal are the same. If there are a primes among these 9 numbers at most, and that the largest prime is b, find a x b.

The answer is 133, which means a = 7 and b = 19, but I can't find the complete square numbers.

  • 2
    $\begingroup$ You should start by adding a note to the question that tells where this puzzle is from. (This is required by the site policy, when you post a puzzle to which you don't own the copyright.) Then, take any "regular" magic square with digits 1-9, double each number, and add one. $\endgroup$
    – Bass
    Commented Jul 12, 2021 at 16:22

1 Answer 1


The following is a full solution to the original puzzle, without cheating from knowing the values of a and b.

The primes under 20 are 2, 3, 5, 7, 11, 13, 17, and 19.

If we assume all eight primes are used:

Observe that 2 is even and the other seven are odd. Regardless of the ninth number in the grid, you will have one line full of odd primes (which sums to an odd number), and another line containing the number 2 and two odd primes (which sums to an even number). Since an odd number cannot be equal to an even number, we cannot use all eight primes.


Let's try using the seven odd primes. My instinct tells me that the seven primes are part of the nine consecutive odd numbers: 3, 5, 7, 9, 11, 13, 15, 17, 19. They can easily form a magic square, in the same way 1 through 9 are laid out.

One possible magic square is

17  3 13
 7 11 15
 9 19  5

  • 1
    $\begingroup$ A magic square is one where the sum of all rows, columns, (and by some definitions, diagonals) are the same. $\endgroup$
    – El-Guest
    Commented Jul 12, 2021 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.