import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.symbolic.ring import SR
from sage.combinat.partition import Partitions
from sage.combinat.sf.sf import SymmetricFunctions
from math import factorial, prod
def unitary_weingarten(N, mu):
k = sum(mu)
SF = SymmetricFunctions(QQ)
s, p = SF.schur(), SF.power()
answer = QQ(0)
for lam in Partitions(k):
if len(lam) > N:
continue
f = s[lam].scalar(p[[1] * k])
chi = s[lam].scalar(p[list(mu)])
c = prod(N + j - i for i, row in enumerate(lam) for j in range(row))
answer += QQ(f * chi) / QQ(c)
return answer / QQ(factorial(k))
print(unitary_weingarten(13, (3, 1))) # 67/149909760
The attached generator evaluates the character sum over $\mathbb Q$, using the Murnaghan–Nakayama rule for symmetric-group characters and the hook-length formula for their dimensions. Every value is an exact rational; no numerical precision or rounding is used.
All 242 coefficients were independently recovered by enumerating permutations and solving the conjugacy-class Gram inverse equations with rational Gaussian elimination. The checks also compare all coefficients with Sage's symmetric-function character expansion, all 57 admissible pairs $(N,k)$ with the Haar moment $\mathbb E|U_{11}|^{2k}=k!/[N(N+1)\cdots(N+k-1)]$, and all 34 degree-one and degree-two coefficients with (4). Nonzero controls and a deliberately corrupted inverse coefficient test the checking procedure.