Associative Magic Square

Author

Eric W. Weisstein
March 14, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/RecreationalMath/AssociativeMagicSquare.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/AssociativeMagicSquare.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Initialization

<<MagicSquares`;

Enumeration

Count[#,_?AssociativeQ]&/@Table[MagicSquares[n],{n,4}]

3×3

AssociativeQ/@MagicSquares[3]

4×4

Length[assoc=Select[MagicSquares[4],AssociativeQ]]

Show[GraphicsArray[Partition[MagicSquarePlot[#,TextStyle->{FontSize->9,FontFamily->"Times",FontSlant->"Italic"},DisplayFunction->Identity]&/@assoc,8]]]

Panmagic and Associative

Count[#,_?(AssociativeQ[#]&&PanmagicQ[#]&)]&/@Table[MagicSquares[n],{n,4}]

PanAssoc={
{1,15,24,8,17},
{23,7,16,5,14},
{20,4,13,22,6},
{12,21,10,19,3},
{9,18,2,11,25}};

Through[{PanmagicQ,AssociativeQ}[PanAssoc]]

MagicSquarePlot[PanAssoc]