%I #30 May 13 2024 21:17:05
%S 1,9,1089,73441,100280196,1977847729,4146497327025,4187530604721424,
%T 121439588246116522561
%N Largest square that can be expressed as Sum_{i=1..n} p(2i-1)^p(2i) where p is a permutation of {1, 2, 3, ..., 2n}.
%C It is unknown whether a(n) exists for all n (at least one sum is a square), but it is expected. It is also unknown whether the sequence is strictly increasing.
%C a(n) exists for n <= 11. - _Chai Wah Wu_, May 13 2024
%H Bryle Morga et al., <a href="https://mathoverflow.net/questions/470816/does-there-exists-a-sigma-in-s-2n-such-that-sum-n-1n-sigma2n-1">MathOverflow post about this sequence</a>
%e a(3) = 1089 = 33^2 = 1^3 + 4^5 + 2^6.
%e a(8) = 4187530604721424 = 64711132^2 = 14^1 + 16^2 + 5^3 + 4^6 + 7^8 + 9^12 + 10^13 + 11^15.
%o (Python)
%o import itertools
%o import math
%o def a(n):
%o res = 0
%o for p in itertools.permutations([i for i in range(1, 2*n + 1)], n):
%o i = 0
%o s = 0
%o for j in range(1, 2*n + 1):
%o if j not in p:
%o s += p[i]**j
%o i += 1
%o if math.isqrt(s)**2 == s:
%o res = max(res, s)
%o return res
%o (Python)
%o from itertools import combinations, permutations
%o from sympy.ntheory.primetest import is_square
%o def A372653(n):
%o a, m, f = set(range(1,2*n+1)), 0, [[b**c for c in range(2*n+1)] for b in range(2*n+1)]
%o for b in combinations(a,n):
%o clist = sorted(a-set(b))
%o for d in permutations(range(n)):
%o k = sum(f[b[i]][clist[d[i]]] for i in range(n))
%o if k>m and is_square(k):
%o m = k
%o return m # _Chai Wah Wu_, May 13 2024
%Y Cf. A372652.
%K nonn,hard,more
%O 1,2
%A _Bryle Morga_, May 08 2024
%E a(9) from _Chai Wah Wu_, May 13 2024