import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
def rho(p, q, u):
k = (u * pow(q, -1, p)) % p
def saw(n):
r = n % p
return QQ(0) if r == 0 else QQ(r)/QQ(p) - QQ(1)/QQ(2)
return -4*sum((saw(q*j) for j in range(1, k)), QQ(0)) - 2*saw(q*k)
print(rho(7, 2, 1))Computed by (2) using exact Sage rational arithmetic. Every selected value agrees with direct weighted lattice-point counts from [1], equation (2.4), and with the difference of the twisted and untwisted eta values read from T622.
Independent Arb evaluation of (3) at 512 bits encloses every value; all balls are finite, their radii are less than $4.76\times10^{-151}$, and the nonzero values retain at least 498 bits of relative accuracy. Zero, positive and negative controls precede these checks. Conjugation, orientation reversal, coordinate exchange and the homogeneous formula are checked on all 1744 character labels through $p=20$, including reconstruction from the selected rows. The attached generator, checks, argument-selection note and numerical evidence reproduce the computation.