%I #19 Jan 16 2019 19:42:28
%S 1,1,1,1,10,21,97,657,5618,48918,494530,5383553,65112565,840566081,
%T 11834555867,176621056393,2838064404989,48060623405313
%N Number of non-normal magic squares whose entries are nonnegative integers summing to n.
%C A non-normal magic square is a square matrix with row sums, column sums, and both diagonals all equal to d, for some d|n.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Magic_square">Magic square</a>
%H <a href="/index/Mag#magic">Index entries for sequences related to magic squares</a>
%F a(p) = A007016(p) + 1 if p is prime. a(n) >= A007016(n) + 1 for n > 1. - _Chai Wah Wu_, Jan 15 2019
%e The a(4) = 10 magic squares:
%e [4]
%e .
%e [1 1]
%e [1 1]
%e .
%e [1 0 0 0][1 0 0 0][0 1 0 0][0 1 0 0][0 0 1 0][0 0 1 0][0 0 0 1][0 0 0 1]
%e [0 0 1 0][0 0 0 1][0 0 1 0][0 0 0 1][1 0 0 0][0 1 0 0][1 0 0 0][0 1 0 0]
%e [0 0 0 1][0 1 0 0][1 0 0 0][0 0 1 0][0 1 0 0][0 0 0 1][0 0 1 0][1 0 0 0]
%e [0 1 0 0][0 0 1 0][0 0 0 1][1 0 0 0][0 0 0 1][1 0 0 0][0 1 0 0][0 0 1 0]
%t prs2mat[prs_]:=Table[Count[prs,{i,j}],{i,Union[First/@prs]},{j,Union[Last/@prs]}];
%t multsubs[set_,k_]:=If[k==0,{{}},Join@@Table[Prepend[#,set[[i]]]&/@multsubs[Drop[set,i-1],k-1],{i,Length[set]}]];
%t Table[Length[Select[multsubs[Tuples[Range[n],2],n],And[Union[First/@#]==Range[Max@@First/@#]==Union[Last/@#],SameQ@@Join[{Tr[prs2mat[#]],Tr[Reverse[prs2mat[#]]]},Total/@prs2mat[#],Total/@Transpose[prs2mat[#]]]]&]],{n,5}]
%Y Cf. A006052, A007016, A120732, A271103, A319056, A319616.
%Y Cf. A321718, A321719, A321720, A321721.
%K nonn,more
%O 0,5
%A _Gus Wiseman_, Nov 18 2018
%E a(7)-a(15) from _Chai Wah Wu_, Jan 15 2019
%E a(16)-a(17) from _Chai Wah Wu_, Jan 16 2019
|