login
A362280
a(n) is the number of n X n matrices using all the integers from 1 to n^2 with trace equal to the antitrace.
1
1, 8, 32640, 606108303360, 288646869784585568256000, 3978466023641262138239999300075520000000, 4808293482959682489757553576215163849442438886195200000000000, 669887741948823664389458168162886859168459418141304785844082510440658108416000000000000
OFFSET
1,2
FORMULA
a(n) = A362291(n)*(m!)^2*(n^2 - 2*m)!, where m = 2*floor(n/2).
EXAMPLE
a(1) = A362209(1,1) = 1 since we have:
[1].
a(2) = A362209(5,2) = 8 since we have:
[1, 2] [1, 3] [4, 2] [4, 3]
[3, 4], [2, 4], [3, 1], [2, 1],
.
[2, 1] [2, 4] [3, 1] [3, 4]
[4, 3], [1, 3], [4, 2], [1, 2].
PROG
(Python)
from math import factorial
from itertools import combinations as C
def a(n):
E = [i for i in range(1, n**2+1)]
m = n if n%2 == 0 else n-1
r = n**2 - 2*m
fm, fr = factorial(m), factorial(r)
p = fm**2 * fr
return p*sum(1 for u in C(E, 2*m) for t in C(u, m) if 2*sum(t)==sum(u))
print([a(n) for n in range(1, 5)])
CROSSREFS
KEYWORD
nonn,hard,more
AUTHOR
EXTENSIONS
a(6)-a(8) calculated from A362291 by Martin Ehrenstein, Apr 25 2023
STATUS
approved