OFFSET
1,1
COMMENTS
Also numbers n for which all possible n X n magic squares are prime.
Note that there are no 2 X 2 magic squares.
All primes, except 2, belong to this sequence. This is because p X p magic squares, with p primes, cannot be derived from smaller magic squares. Otherwise p would be equal to a product of smaller integers. Also, since there are no 2 X 2 magic squares, we cannot have a (2p) X (2p) that could be derived from smaller magic squares. And also we cannot have an 8 X 8 derived magic square (see first example). So this sequence is A065091 (odd primes) U A100484 (even semiprimes) U {8}. And A100484 U {8} is also A161344 (see second comment by Zak Seidov there). So this sequence is: A065091 U A161344. - Michel Marcus, Dec 07 2013
LINKS
Allan Adler, Math Forum: Multiplying Two Magic Squares
Allan Adler, Math Forum: 12x12 Magic Square
EXAMPLE
8 qualifies because a composite 8 X 8 magic square is impossible, such a square would require a 2 X 2 magic square, and there are none (see 2nd link).
9 is not part of sequence because a 9 X 9 magic square can be created by multiplying a 3 X 3 magic square by itself.
Similarly 12 is not part of sequence because a 12 X 12 magic square can be created by multiplying a 3 X 3 magic square and a 4 X 4 magic square (see 3rd and 4th links).
PROG
(PARI) isok(n) = (isprime(n) && (n%2)) || (n==8) || (!(n%2) && isprime(n/2)); \\ Michel Marcus, Dec 07 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
J. Lowell, Nov 30 2013
EXTENSIONS
More terms from Michel Marcus, Dec 07 2013
Replaced definition with a more explicit one, following the comments of Michel Marcus. - N. J. A. Sloane, Dec 19 2019
STATUS
approved