cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A321722 Number of non-normal magic squares whose entries are nonnegative integers summing to n.

Original entry on oeis.org

1, 1, 1, 1, 10, 21, 97, 657, 5618, 48918, 494530, 5383553, 65112565, 840566081, 11834555867, 176621056393, 2838064404989, 48060623405313
Offset: 0

Views

Author

Gus Wiseman, Nov 18 2018

Keywords

Comments

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.

Examples

			The a(4) = 10 magic squares:
  [4]
.
  [1 1]
  [1 1]
.
  [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]
  [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]
  [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]
  [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]
		

Crossrefs

Programs

  • Mathematica
    prs2mat[prs_]:=Table[Count[prs,{i,j}],{i,Union[First/@prs]},{j,Union[Last/@prs]}];
    multsubs[set_,k_]:=If[k==0,{{}},Join@@Table[Prepend[#,set[[i]]]&/@multsubs[Drop[set,i-1],k-1],{i,Length[set]}]];
    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}]

Formula

a(p) = A007016(p) + 1 if p is prime. a(n) >= A007016(n) + 1 for n > 1. - Chai Wah Wu, Jan 15 2019

Extensions

a(7)-a(15) from Chai Wah Wu, Jan 15 2019
a(16)-a(17) from Chai Wah Wu, Jan 16 2019