5
$\begingroup$

Is it possible to have an $n \times n$ magic square with a another magic square of $\frac n 4 \times \frac n 4$ magic square inside it? If so provide an example, if not prove if impossible.

Rules:

  1. $n$ cannot be 4

Clarifications:

  1. A magic square is an $n \times n$ grid filled with numbers 1, ..., $n \times n$ (this goes for the inside square too)
$\endgroup$
2
  • 1
    $\begingroup$ I'm assuming $n$ cannot be $4$? (Otherwise, this would be very easy ;) ) $\endgroup$
    – Doorknob
    Dec 16, 2014 at 23:45
  • $\begingroup$ @Doorknob Oh yeah, forgot to add that in lol! $\endgroup$
    – warspyking
    Dec 17, 2014 at 0:01

1 Answer 1

8
$\begingroup$

It's possible for any $n$ divisible by 4, other than $n=8$.

First, find a magic square of size $n/4$. (This is impossible when $n=8$.) Call it $\mathcal{M}$. Now consider the following 4 by 4 magic square $\mathcal{S}$, using the numbers 0 through 15:

$\left( \begin{array}{ccc} 8 & 5 & 2 & 15 \\ 3 & 14 & 9 & 4 \\ 13 & 0 & 7 & 10 \\ 6 & 11 & 12 & 1 \end{array} \right)$

For each number $k$ in this square, replace it by a copy of $\mathcal{M}$ with every number increased by $kn^2/16$. One can easily check that the resulting square must be magic, because both of the starting squares are.

If you've heard of a tensor product or Kronecker product, then this should feel like the product of two magic squares.

$\endgroup$
9
  • $\begingroup$ Normally a magic square is filled with 1, ..., n (so if a magic square is inside it, it would contain 1, ..., n/4) $\endgroup$
    – warspyking
    Dec 17, 2014 at 0:36
  • $\begingroup$ If $\mathcal{M}$ contains the numbers 1 through $n^2/16$, then the procedure in this answer should produce a new square containing the numbers 1 through $n^2$. Unless I screwed up. $\endgroup$
    – Lopsy
    Dec 17, 2014 at 0:39
  • $\begingroup$ Could you fix this then? Also look at the clarification I added in the question. $\endgroup$
    – warspyking
    Dec 17, 2014 at 0:42
  • $\begingroup$ How do you fill an n by n magic square with the numbers 1 through n? Do you use each number n times? I've never seen a magic square where you're allowed to repeat numbers. $\endgroup$
    – Lopsy
    Dec 17, 2014 at 1:06
  • 1
    $\begingroup$ I'll suggest several improvements: 1) you might want to replace "tensor product" with "Kronecker product" since a tensor product is more general, 2) your example $\mathcal{M}$ should have all elements incremented by 1 to meet the spec, 3) for the programmers in the crowd, the MATLAB code snippet big_M = kron( M - 1, ones( n/4, n/4 )*n ) + kron( ones( n/4, n/4 ), S ), where $\mathsf{M} = \mathcal{M}$ and $\mathsf{S} = \mathcal{S}$, might help to clarify the concept. +1 for your answer, though. $\endgroup$
    – COTO
    Dec 17, 2014 at 1:21

Your Answer

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

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