This is a modified 3x3 panmagic squares.

enter image description here

The square is divided into 2 triangles.
Numbers 1 to 9 is arranged to upper triangles.
Numbers 10 to 18 is arranged to lower triangles.
All rows, all columns, and all the diagonals, including those obtained by "wrapping around" the edges sum to the same magic constant.

The question is :

Without checking all the possibilities using a computer, determine how many solutions the magic square has ?

  • $\begingroup$ It's not 100% clear what's going on with the diagonals. If we label the values in the triangles A\a, B\b, C\c (top row), D\d, E\e, F\f (middle row), G\g, H\h, I\i (bottom row), do we have a total of six diagonal sums equal to X, namely AaEeIi, BbFfGg, CcDdHh running NW-SE and AaFfHh, BbDdIi, CcEeGg running NE-SW? $\endgroup$
    – Gareth McCaughan
    Sep 5, 2016 at 9:37
  • $\begingroup$ @GarethMcCaughan, yes that's what I mean. $\endgroup$ Sep 5, 2016 at 9:38

2 Answers 2


I believe the answer is

9! = 362880.


The values in the individual triangles are important only in so far as they determine (or are determined by) the total value in each square, since all the given conditions are about sums of square values. So first of all let us write a,b,c,d,e,f,g,h,i for the total values in the nine squares in "reading order".

(Actually, first of all let's remark that the sum of all the numbers equals 1+2+...+17+18 = 171 and also equals 3X, so X = 57.)
We have 12 sums that have to equal 57: three rows, three columns, three \ diagonals, three / diagonals. That's 12 conditions on 9 numbers, but of course they're redundant. We can instead write them as: sum of all the numbers, then two each of rows, columns, \, /. That's a total of nine linear (well, affine) relations on nine numbers, and I'm pretty sure they're linearly independent. That means that the only solution is that a=b=c=d=e=f=g=h=i=19.

The only way to do that is to pair up 1,18 and 2,17 and 3,16 and so on. Having done that, thought, we can put 'em in any order. Therefore the total number of solutions is 9! = 362880.

Small hole:

I haven't actually proved linear independence of those constraints. If asked, I can either supply a proof or confess that I goofed :-).

  • $\begingroup$ I believe it will be more than that... $\endgroup$ Sep 5, 2016 at 10:13
  • $\begingroup$ @TejasvaDhyani Before asking, I've checked the answer with computer, and gareth answer is correct. $\endgroup$ Sep 5, 2016 at 10:14
  • $\begingroup$ @Tejasva Dhyani, you posted an answer saying it's 64 and now you believe it should be more than 300,000? :-) $\endgroup$
    – Gareth McCaughan
    Sep 5, 2016 at 10:16
  • $\begingroup$ Guys if you want I can share a case which does not come under your solution case $\endgroup$ Sep 5, 2016 at 10:35
  • 1
    $\begingroup$ Surely the broken diagonals are wrong. E.g., top centre + right centre + bottom left is 23+11+17 = 51, not 57. $\endgroup$
    – Gareth McCaughan
    Sep 5, 2016 at 11:32

64 ??

This is just the answer, if it is the correct one, then I can explain the logic


Certainly it is not the correct answer but still would like to share my point.

There are 8 different ways to solve the 3x3 magic square (having 1-9) problem. Similarly for the one having 10-18 can also be solved by 8 different ways. So combining the two there would be 8x8 = 64 different ways.

Still I believe there will be more... still solving it

  • $\begingroup$ Welcome to Puzzling! Bare answers without explanation are generally frowned on here; if you believe your answer is correct then you should explain why. It's also generally considered polite to hide the key part(s) of your answer by preceding paragraphs with >! so that if you're right you won't take away the fun from others wanting to solve the puzzle on their own. $\endgroup$
    – Gareth McCaughan
    Sep 5, 2016 at 10:10
  • $\begingroup$ The things I think you're missing are (1) that there are extra constraints on this square beyond the ones that lead to 8 magic squares -- the "broken diagonals" need to have the correct sum -- and (2) that lower+upper can be magic even if lower,upper are not magic on their own. $\endgroup$
    – Gareth McCaughan
    Sep 5, 2016 at 10:34
  • $\begingroup$ Yes for that I think you have calculated it right. But m also concerned about the individual magic sqaures... in the end they also form the correct answer $\endgroup$ Sep 5, 2016 at 10:48

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.