import numberdb.sage as numberdb
from functools import lru_cache
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RealBallField
from sage.arith.misc import moebius
R = RealBallField(numberdb.bits(100, losing=128))
C = (2*R.pi()).log() - R.euler_constant()
@lru_cache(None)
def V(p, q):
return sum((R(QQ((m*p) % q)/q)*(R.pi()*R(QQ(m)/q)).cot()
for m in range(1,q)), R(0))
@lru_cache(None)
def A(r):
p, q = int(r.numerator()), int(r.denominator())
x = R(r)
return ((1-x)*x.log()+(1+x)*C)/2 - R.pi()*(V(p,q)+V(q,p))/(2*q)
def U(N):
assert N >= 1
w = [moebius(n) for n in range(1,N+1)]
return 1 + 2*sum((w[n-1]*(R(n).log()+1-R.euler_constant())/n
for n in range(1,N+1)), R(0)) + sum(
(w[j-1]*w[k-1]*A(QQ(j)/k)/j
for j in range(1,N+1) for k in range(1,N+1)), R(0))
# The stored prefix is every N=1,...,30; U also accepts larger N.
print(U(10))
Computed with Arb real balls at 461 working bits. Exact integer Möbius weights and finite cotangent sums at exact rational arguments give the Gram matrix; ball arithmetic propagates the error through every squared norm. All 30 values are finite, retain at least 444 bits of relative accuracy, and have radii below $7.30\times10^{-136}$, sufficient for the 100 significant digits stored. No rounded companion values are used as inputs.
A separate 720-bit calculation integrates the piecewise quadratic fractional-part product against the trigamma kernel, evaluating 16 terms analytically and enclosing the remaining series after powers 0 through 125 with an explicit alternating-series bound. All 465 symmetric Gram entries and all 30 norms agree; the independent norm radii are below $6.05\times10^{-151}$. Direct whole-residual integrals also agree at $N=1,2,3,6$. Known-answer controls and deliberate incorrect, wide-ball and NaN controls test the checker. All nonsquarefree repetitions, exterior-tail bounds, and lower bounds from independently solved least-squares systems pass. The attached generator, checks and derivation preserve the executable evidence.