"""Certify linear forms in the elliptic triangle moments at z=1. Python 3.9+.""" from collections import defaultdict if not __debug__: raise RuntimeError("Certificate verification requires assertions enabled") from fractions import Fraction from math import factorial, lcm ORDER = 64 SCALE = 10**38 MAX_HEIGHT = 1000 def elliptic_moments(): """Return two integer numerators, each with absolute error < 1/SCALE.""" # x = 1/2-u, y = u*v, 0 <= u <= 1, -1 <= v <= 1. The # coefficients below are for 8*q in the variables u and w=v**2. phase = {(0, 0): 11, (1, 0): -18, (2, 0): -12, (3, 0): 8, (2, 1): 8} power = {(0, 0): 1} sums = [Fraction(0), Fraction(0)] common = lcm(*range(1, 3 * ORDER + 4)) for n in range(ORDER + 1): plain = shifted = 0 for (i, j), coeff in power.items(): even_integral = coeff * (common // (2 * j + 1)) plain += even_integral * (common // (i + 2)) shifted += even_integral * (common // (i + 3)) denominator = common**2 * 8**n * factorial(n) sums[0] += Fraction(2 * plain, denominator) sums[1] += Fraction(plain - 2 * shifted, denominator) if n < ORDER: next_power = defaultdict(int) for (i, j), coeff in power.items(): for (di, dj), weight in phase.items(): next_power[i + di, j + dj] += coeff * weight power = next_power # Triangle area 1, |q| <= 3, |x| <= 1/2, successive tail ratio < 1/2. tail = Fraction(2 * 3 ** (ORDER + 1), factorial(ORDER + 1)) numerators = [round(x * SCALE) for x in sums] for center, approx in zip(numerators, sums): assert abs(Fraction(center, SCALE) - approx) + tail < Fraction(1, SCALE) return numerators def certify(moments): assert 10000 * (abs(moments[1]) - 1) > 119 * SCALE assert 10**6 * (abs(moments[1]) + 1) < 11901 * SCALE # Verify |L| > c*H**(-5/2). Squaring makes each comparison integral. # When h0 differs from the integer nearest the *center*, |L| is at # least 1/2 - 2*MAX_HEIGHT/SCALE. These triples need no enumeration. best = None pairs = 0 a, b = moments for h1 in range(MAX_HEIGHT + 1): first_h2 = 1 if h1 == 0 else -MAX_HEIGHT for h2 in range(first_h2, MAX_HEIGHT + 1): pairs += 1 dot = h1 * a + h2 * b h0 = -((dot + SCALE // 2) // SCALE) if abs(h0) > MAX_HEIGHT: continue height = max(abs(h0), h1, abs(h2)) lower = abs(h0 * SCALE + dot) - h1 - abs(h2) assert lower > 0 score = lower**2 * height**5 if (h0, h1, h2) != (0, 0, 1): assert score * 10**12 > (11901 * SCALE) ** 2 if best is None or score < best[0]: best = (score, (h0, h1, h2)) # Sign symmetry covers the other half. For (h1,h2)=(0,0), |L|>=1. assert pairs == ((2 * MAX_HEIGHT + 1) ** 2 - 1) // 2 return best, pairs if __name__ == "__main__": centers = elliptic_moments() (score, triple), count = certify(centers) # Round the guaranteed constant down to six decimal places. from math import isqrt c_millionths = isqrt(score * 10**12) // SCALE assert 0 < c_millionths < 500000 assert c_millionths == 11900 and triple == (0, 0, 1) assert 2 * MAX_HEIGHT * 10**6 < (500000 - c_millionths) * SCALE assert Fraction(1, 2) - Fraction(2 * MAX_HEIGHT, SCALE) > Fraction(11901, 10**6) print("centers /", SCALE, "=", centers) print("pairs up to sign:", count, "minimum lower score attained at:", triple) print("certified c =", Fraction(c_millionths, 10**6), "for H <=", MAX_HEIGHT) print( "All triples except the two signs of (0, 0, 1) exceed the normalized score 11901/1000000." )