Trimagic Cube

Author

Eric W. Weisstein
December 6, 2003

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

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

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

Boyer's 64

MagicConstant[3,64]

Dimensions[c=PerfectMagicCubes[64][[1]]]

PerfectMagicQ/@{c,c^2,c^3,c^4}//Timing

PerfectMagicQ[#,Method->Loops]&/@{c,c^2,c^3,c^4}//Timing

SemiperfectMagicQ/@{c,c^2,c^3,c^4}//Timing

Boyer's 256

MagicConstant[3,256]

Dimensions[c=Developer`ToPackedArray[PerfectMagicCubes[256][[1]],Integer]]//Timing

Check of Base Cube

ByteCount[c]/1024.^2

PerfectMagicQ[c]//Timing

PerfectMagicQ[c,Method->Loops]//Timing

Sort[Flatten[c]]==Range[256^3]//Timing

Check of Cube Squared

Do[
Print[{n,PerfectMagicQ[c^n,Method->Loops]//Timing}],
{n,4}]

PerfectMagicQ[c^2,Method->Loops]//Timing

PerfectMagicQ[c^3,Method->Loops]//Timing

PerfectMagicQ[c^4,Method->Loops]//Timing