%I #26 Apr 11 2020 17:23:39
%S 1,1,3,7,28,121,746,5041,40608,362936,3635017,39916801,479206146,
%T 6227020801,87187426839,1307674521272,20923334906117,355687428096001,
%U 6402415241245577,121645100408832001,2432905938909013343,51090942176372298027,1124001180562929946213
%N Number of non-normal semi-magic squares with sum of entries equal to n.
%C A non-normal semi-magic square is a nonnegative integer matrix with row sums and column sums all equal to d, for some d|n.
%C Squares must be of size k X k where k is a divisor of n. This implies that a(p) = p! + 1 for p prime since the only allowable squares are of sizes 1 X 1 and p X p. The 1 X 1 square is [p], the p X p squares are necessarily permutation matrices and there are p! permutation matrices of size p X p. Also, a(n) >= n! + 1 for n > 1. - _Chai Wah Wu_, Jan 13 2019
%H Andrew Howroyd, <a href="/A321719/b321719.txt">Table of n, a(n) for n = 0..100</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 a(p) = p! + 1 for p prime and a(n) >= n! + 1 for n > 1 (see comment above). - _Chai Wah Wu_, Jan 13 2019
%F a(n) = Sum_{d|n} A257493(d, n/d) for n > 0. - _Andrew Howroyd_, Apr 11 2020
%e The a(3) = 7 semi-magic squares:
%e [3]
%e .
%e [1 0 0] [1 0 0] [0 1 0] [0 1 0] [0 0 1] [0 0 1]
%e [0 1 0] [0 0 1] [1 0 0] [0 0 1] [1 0 0] [0 1 0]
%e [0 0 1] [0 1 0] [0 0 1] [1 0 0] [0 1 0] [1 0 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@@Total/@prs2mat[#],SameQ@@Total/@Transpose[prs2mat[#]]]&]],{n,5}]
%Y Cf. A006052, A120732, A120733, A257493, A271103, A319056, A319616.
%Y Cf. A321717, A321718, A321720, A321721, A321722, A321723, A321724.
%K nonn
%O 0,3
%A _Gus Wiseman_, Nov 18 2018
%E a(7) from _Chai Wah Wu_, Jan 13 2019
%E a(6) corrected and a(8)-a(15) added by _Chai Wah Wu_, Jan 14 2019
%E a(16)-a(19) from _Chai Wah Wu_, Jan 16 2019
%E Terms a(20) and beyond from _Andrew Howroyd_, Apr 11 2020
|