(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
return 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)])
|