%I #25 Mar 05 2025 22:04:40
%S 1,1,2,1,6,1,3,24,1,120,1,4,21,720,1,5040,1,5,282,40320,1,55,362880,1,
%T 6,6210,3628800,1,39916800,1,7,120,2008,202410,479001600,1,6227020800,
%U 1,8,9135630,87178291200,1,231,153040,1307674368000,1,9,10147
%N Irregular triangle read by rows where T(n,k) is the number of d X d non-normal semi-magic squares with d = A027750(n,k) and sum of all entries equal to n.
%C A non-normal semi-magic square is a nonnegative integer square matrix with all row sums and column sums equal to d, for some d|n.
%H Chai Wah Wu, <a href="/A321725/b321725.txt">Table of n, a(n) for n = 1..60</a>
%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 T(n, A000005(n)) = n!. Sum_k T(n,k) = A321719(n). - _Chai Wah Wu_, Jan 15 2019
%e Triangle begins:
%e 1
%e 1 2
%e 1 6
%e 1 3 24
%e 1 120
%e 1 4 21 720
%e The T(6,2) = 4 semi-magic squares (zeros not shown):
%e [3 ] [2 1] [1 2] [ 3]
%e [ 3] [1 2] [2 1] [3 ]
%e The T(6,3) = 21 semi-magic squares (zeros not shown):
%e [2 ] [2 ] [2 ] [1 1 ] [1 1 ] [1 1 ] [1 1 ]
%e [ 2 ] [ 1 1] [ 2] [1 1 ] [1 1] [ 1 1] [ 2]
%e [ 2] [ 1 1] [ 2 ] [ 2] [ 1 1] [1 1] [1 1 ]
%e .
%e [1 1] [1 1] [1 1] [1 1] [ 2 ] [ 2 ] [ 2 ]
%e [1 1 ] [1 1] [ 2 ] [ 1 1] [2 ] [1 1] [ 2]
%e [ 1 1] [ 2 ] [1 1] [1 1 ] [ 2] [1 1] [2 ]
%e .
%e [ 1 1] [ 1 1] [ 1 1] [ 1 1] [ 2] [ 2] [ 2]
%e [2 ] [1 1 ] [1 1] [ 1 1] [2 ] [1 1 ] [ 2 ]
%e [ 1 1] [1 1] [1 1 ] [2 ] [ 2 ] [1 1 ] [2 ]
%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[k]==Union[Last/@#],SameQ@@Total/@prs2mat[#],SameQ@@Total/@Transpose[prs2mat[#]]]&]],{n,5},{k,Divisors[n]}]
%Y Cf. A006052, A007016, A027750, A120732, A319056, A319616.
%Y Cf. A321718, A321719, A321721, A321722, A321724.
%K nonn,tabf,changed
%O 1,3
%A _Gus Wiseman_, Nov 18 2018
%E a(15)-a(48) from _Chai Wah Wu_, Jan 15 2019
%E Edited by _Peter Munn_, Mar 05 2025