#!/usr/bin/env python3 # -*- coding: utf-8 -*- """R1 refutation check (second-moment route, no fourth moment needed). R1 (the arithmetic entry the (D1) route needs; dossier S7): |S(t,r;c)| << sqrt(c*G) * c^{-eta}, G = (t,r,c), eta >= 7/190, uniform in t. On the class (t,c) = 1 we have G = 1, so R1 asserts |S(t,r;c)| <= sqrt(c)*c^{-eta}. This script shows that class is FALSE for every eta > 0, by an elementary second-moment argument. Note: for (t,c) = 1 every convention for S agrees (unit-sum vs full-residue-sum), so the refutation is convention-independent. The script uses the unit convention x in (Z/c)^*, the one for which the corpus's identity sum_{t mod c} |S(t,r;c)|^2 = c*phi(c) holds. Ingredients: (i) per prime, sum_{t mod p} |S(t,r;p)|^2 = p^2 - p and S(0,r;p) = -1, hence sum_{t != 0} |S(t,r;p)|^2 = p^2 - p - 1 =: A_p; (ii) c squarefree, (tr,c)=1 => S(t,r;c) = prod_{p|c} S(t_p,r_p;p) (CRT), hence sum_{(t,c)=1} |S(t,r;c)|^2 = prod_{p|c} A_p; (iii) therefore the RMS over the phi(c) units is R = (prod A_p / phi(c))^{1/2} = sqrt(c) * sqrt( prod_p (1 - 1/(p(p-1))) ) >= sqrt(c)/2, so max_{(t,c)=1} |S(t,r;c)| >= R >= sqrt(c)/2. R1 at G=1 would demand max <= sqrt(c) c^{-eta} < sqrt(c). Contradiction, any eta > 0. run: python r1-refute-check.py """ import math # ---------------------------------------------------------------- prime level def inv_table(p): return [0] + [pow(x, p - 2, p) for x in range(1, p)] def kloosterman_prime(p, t, r, inv): """S(t,r;p) = sum_{x in (Z/p)^*} e_p(t x + r x^{-1}); returns |S|^2 (float).""" re = im = 0.0 for x in range(1, p): k = (t * x + r * inv[x]) % p ang = 2 * math.pi * k / p re += math.cos(ang) im += math.sin(ang) return re * re + im * im def prime_level(p, r=1): inv = inv_table(p) second_all = 0.0 second_ne0 = 0.0 max_ne0 = 0.0 for t in range(p): n2 = kloosterman_prime(p, t, r, inv) second_all += n2 if t != 0: second_ne0 += n2 max_ne0 = max(max_ne0, math.sqrt(n2)) rms = math.sqrt(second_ne0 / (p - 1)) return { "p": p, "second_all": second_all, "second_all_exact": p * p - p, "second_all_ok": abs(second_all - (p * p - p)) < 1e-6 * p * p, "second_ne0": second_ne0, "second_ne0_exact": p * p - p - 1, "second_ne0_ok": abs(second_ne0 - (p * p - p - 1)) < 1e-6 * p * p, "rms_over_sqrtp": rms / math.sqrt(p), "max_over_sqrtp": max_ne0 / math.sqrt(p), } # ------------------------------------------------------------ composite level def kloosterman_composite(c, t, r): """|S(t,r;c)|^2 by direct summation over the units mod c.""" re = im = 0.0 for x in range(1, c): if math.gcd(x, c) != 1: continue k = (t * x + r * pow(x, -1, c)) % c ang = 2 * math.pi * k / c re += math.cos(ang) im += math.sin(ang) return re * re + im * im def composite_table(c, r=1): """max over units, sum over units, corpus identity, and the product model.""" mx = 0.0 s_units = 0.0 n_units = 0 s_all = 0.0 for t in range(c): n2 = kloosterman_composite(c, t, r) s_all += n2 if math.gcd(t, c) == 1: s_units += n2 n_units += 1 mx = max(mx, math.sqrt(n2)) return {"c": c, "max": mx, "s_units": s_units, "n_units": n_units, "s_all": s_all, "identity_cphi": c * sum(1 for t in range(c) if math.gcd(t, c) == 1)} def prime_factors(n): fs = [] d = 2 while d * d <= n: while n % d == 0: fs.append(d) n //= d d += 1 if n > 1: fs.append(n) return fs def product_model(c): """prod_{p|c} A_p and prod_p (1 - 1/(p(p-1))) and the resulting RMS bound.""" prod_A = 1.0 prod_ratio = 1.0 for p in prime_factors(c): prod_A *= (p * p - p - 1) prod_ratio *= (1.0 - 1.0 / (p * (p - 1))) phi_c = 1 for p in prime_factors(c): phi_c *= (p - 1) return prod_A, prod_ratio, phi_c, math.sqrt(prod_A / phi_c) / math.sqrt(c) if __name__ == "__main__": print("== (i) per prime: second moment, and the t=0 term ==") for p in [101, 211, 401, 701, 1009]: d = prime_level(p) print("p=%-5d sum_t|S|^2 = %-10.2f (p^2-p=%-9d ok=%s) sum_{t!=0}|S|^2 = %-10.2f " "(p^2-p-1=%d ok=%s)" % (d["p"], d["second_all"], d["second_all_exact"], d["second_all_ok"], d["second_ne0"], d["second_ne0_exact"], d["second_ne0_ok"])) print(" RMS_{t!=0}|S| / sqrt(p) = %.4f max_{t!=0}|S| / sqrt(p) = %.4f" % (d["rms_over_sqrtp"], d["max_over_sqrtp"])) print(" => RMS over t != 0 is already >= sqrt(p)/2, so max_{t!=0} |S| >= sqrt(p)/2." "\n (the fourth-moment route used earlier gives the same conclusion; this one is elementary.)") print("\n== (ii)-(iii) squarefree composites: attained max over units ==") for c in [15, 21, 35, 105, 143, 1001]: t = composite_table(c) prod_A, prod_ratio, phi_c, rms_bound = product_model(c) print("c=%-5d units=%-4d sum_units|S|^2 = %-12.2f identity c*phi(c) = %-12d " "max_units|S|/sqrt(c) = %.4f" % (c, t["n_units"], t["s_units"], t["identity_cphi"], t["max"] / math.sqrt(c))) print(" product model: prod A_p = %.0f RMS/sqrt(c) = %.4f " "(prod_p(1-1/(p(p-1))) = %.4f) max/sqrt(c) = %.4f" % (prod_A, rms_bound, prod_ratio, t["max"] / math.sqrt(c))) print("\n== the family shape: c = p1 p2 p3, primes in [Q,2Q), multiplicative model ==") for primes in [(101, 103, 107), (211, 223, 227), (401, 409, 419), (701, 709, 719)]: c = primes[0] * primes[1] * primes[2] prod_A, prod_ratio, phi_c, rms_bound = product_model(c) # max over units = prod_p max_{t_p != 0}|S(t_p,r;p)| prod_max = 1.0 for p in primes: inv = inv_table(p) m = 0.0 for tt in range(1, p): m = max(m, math.sqrt(kloosterman_prime(p, tt, 1, inv))) prod_max *= m print("c=%-12d max_units/sqrt(c) = %-8.4f RMS bound/sqrt(c) = %.4f (>=0.5 always)" % (c, prod_max / math.sqrt(c), rms_bound)) print("\n== what R1 would require at G = 1 ==") print(" claimed: max_{(t,c)=1}|S(t,r;c)| <= sqrt(c) * c^{-eta}, eta >= 7/190 = 0.0368421") print(" proved: max_{(t,c)=1}|S(t,r;c)| >= sqrt(c)/2 (second moment over the units),") print(" and empirically max = prod_p max_p * sqrt(c) = 2^{omega(c)+o(1)} * sqrt(c).") for c in [10 ** 10, 10 ** 19]: eta = 7 / 190 print(" c=1e%-4d sqrt(c) c^{-eta} = %.4e vs sqrt(c)/2 = %.4e -> claimed bound is " "smaller by a factor c^{eta} = %.4e" % (math.log10(c), math.sqrt(c) * c ** (-eta), math.sqrt(c) / 2, c ** eta)) print(" Conclusion: the bound R1 asks for is FALSE for every eta > 0 on the class G = 1.")