Multimagic Series

Author

Eric W. Weisstein
November 8, 2003

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

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

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

Code

(* partitions of p into n parts *)

PartitionsJ[n_,p_]:=Reduce`NaturalLinearSolve[{Range[n]},{p},True][[1]]

MagicSeriesList[n_]:=Flatten[Position[#,1]]&/@Select[PartitionsJ[n^2,n(n^2+1)/2],Max[#]==1&&Count[#,1]==n&]

MagicSeries[n_,1]:=MagicSeries[n,1]=MagicSeriesList[n]
MagicSeries[n_,k_]:=MagicSeries[n,k]=Select[MagicSeries[n,k-1],Plus@@(#^k)==HarmonicNumber[n^2,-k]/n&]

Magic Constants

Table[HarmonicNumber[n^2,-k]/n,{n,6},{k,4}]//TableForm

Magic

Length/@(m1=MagicSeries[#,1]&/@Range[4])//Timing

Length/@(m1=MagicSeries[#,1]&/@Range[5])//Timing

Length/@(m1=MagicSeries[#,1]&/@Range[6])//Timing

Bimagic

Length/@(m2=MagicSeries[#,2]&/@Range[5])//Timing

m2//ColumnForm

Map[Plus@@#&,m2^2,{2}]

Trimagic

Length/@(m3=MagicSeries[#,3]&/@Range[5])//Timing

m3//ColumnForm

Map[Plus@@#&,m3^3,{2}]

Tetramagic

Length/@(m4=MagicSeries[#,4]&/@Range[5])//Timing

m4