#!/usr/bin/env python3 # Job #622: independent check of return #158's two load-bearing numbers. # # (1) "K = 3 exactly" for the twin configuration in condition (5.38): # V(w)/V(z) <= K (log z / log w)^kappa for all 2 <= w < z. # Setting F(t) = V(t) ln^2 t, the worst pair is F(w)/F(z), and since w and z may # STRADDLE a prime (w = p-, z = p+), the sup includes the values 1/(1 - nu(p)/p) # = p/(p - nu(p)): 2 for p=2, 3 for p=3, 5/3, 7/5, ... So the claim K = 3 is the # joint claim: sup_{t>2} F = F(3-) and inf_{t>2} F = F(3+). # (2) The arithmetic chain of their section 3-4: # s0 = 9k + 10 ln K + ln(1/delta); C1(rho) = (1+delta) K (rho s0/(1-eps))^kappa; # c0 = 1/(8 C1 C2 e^{-2gamma}), C2 the twin constant 0.6601618158... import math, sys gamma = 0.5772156649015329 C2twin = 0.6601618158468696 N = int(sys.argv[1]) if len(sys.argv) > 1 else 10_000_000 sieve = bytearray([1]) * (N + 1) sieve[0] = sieve[1] = 0 for i in range(2, int(N ** 0.5) + 1): if sieve[i]: sieve[i * i::i] = bytearray(len(sieve[i * i::i])) primes = [i for i in range(2, N + 1) if sieve[i]] print("primes up to %d: %d" % (N, len(primes))) fmax, argmax = None, None # sup of F at t = p- fmin, argmin = None, None # inf of F at t = p+ f1e6 = None v = 1.0 for p in primes: nu = 1 if p == 2 else 2 Fminus = v * math.log(p) ** 2 # t -> p- Fplus = v * (1.0 - nu / p) * math.log(p) ** 2 # t -> p+ if fmax is None or Fminus > fmax: fmax, argmax = Fminus, p if p >= 3 and (fmin is None or Fplus < fmin): fmin, argmin = Fplus, p if p <= 10 ** 6: f1e6 = Fminus v *= (1.0 - nu / p) print("\n(1) F(t) = V(t) ln^2 t on t > 2") print(" sup F = %.15f at t -> %d-" % (fmax, argmax)) print(" inf F (t > 3) = %.15f at t -> %d+" % (fmin, argmin)) print(" sup/inf = %.12f (they claim exactly 3)" % (fmax / fmin)) straddle = max((1.0 / (1.0 - (1 if p == 2 else 2) / p), p) for p in primes[:6]) print(" worst straddling pair p/(p-nu(p)): %.6f at p=%d" % straddle) print(" F just below the largest prime <= 10^6 = %.15f ; limit 2 C2 e^-2g = %.15f" % (f1e6, 2 * C2twin * math.exp(-2 * gamma))) K = fmax / fmin print("\n(2) the arithmetic chain, recomputed from their formulas") for delta, eps, rho in ((0.05, 0.0, 0.5), (0.05, 0.02, 0.5), (0.01, 0.0, 0.5), (0.01, 0.02, 0.5), (0.05, 0.02, 1.0)): kappa = 2 s0 = 9 * kappa + 10 * math.log(K) + math.log(1 / delta) C1 = (1 + delta) * K * (rho * s0 / (1 - eps)) ** kappa c0 = 1.0 / (8 * C1 * C2twin * math.exp(-2 * gamma)) print(" delta=%.2f eps=%.2f rho=%.1f : s0=%.3f C1=%.1f c0=%.3e [they: %s]" % (delta, eps, rho, s0, C1, c0, {0.05: "805.5 / 7.46e-4", 0.01: "854.7 / 7.03e-4"}.get(delta, "-") if rho == 0.5 and eps == 0 else ("838.7 / 7.16e-4" if (delta, eps, rho) == (0.05, 0.02, 0.5) else ("890.0 / 6.75e-4" if (delta, eps, rho) == (0.01, 0.02, 0.5) else "3354.8 / 1.79e-4"))))