// job #6: smallest admissible constants in the two dimension conditions used by // paper/beta2-note.md, for the twin sequence omega(2) = 1, omega(p) = 2 (p odd). // // DH Definition 1.3 / (1.5): prod_{w1<=p p_j from above (real endpoints), or w = p_j + 1 // (integer endpoints). So the sup over all pairs is a max over prime blocks. // Finite range only: a measurement, not a proof (the proof is Mertens). // Usage: node omega-constants.js [N=1000000] [I=10000] [W=2000] // blocks with p_i < I run to p_j < N; blocks with p_i >= I run W primes past i. 'use strict'; const N = +(process.argv[2] || 1e6), I = +(process.argv[3] || 1e4), W = +(process.argv[4] || 2000); const sieve = new Uint8Array(N + 1); const P = []; for (let n = 2; n <= N; n++) { if (!sieve[n]) { P.push(n); for (let m = n * n; m <= N; m += n) sieve[m] = 1; } } const lg = P.map(p => Math.log(p)); const loss = P.map(p => -Math.log(1 - (p === 2 ? 1 : 2) / p)); const best = { K_real: { v: 0 }, A_real: { v: -Infinity }, K_int: { v: 0 }, A_int: { v: -Infinity }, }; function upd(key, v, i, j) { if (v > best[key].v) best[key] = { v, w1: P[i], pj: P[j] }; } let blocks = 0; const kI = new Float64Array(P.length); // max over blocks starting at p_i of the K ratio (real endpoints) for (let i = 0; i < P.length; i++) { const jmax = P[i] < I ? P.length - 1 : Math.min(P.length - 1, i + W); let L = 0; const l1 = lg[i]; for (let j = i; j <= jmax; j++) { L += loss[j]; const prod = Math.exp(L); const rR = (lg[j] / l1) ** 2; // w -> p_j from above const rI = (Math.log(P[j] + 1) / l1) ** 2; // w = p_j + 1 if (prod / rR > kI[i]) kI[i] = prod / rR; upd('K_real', prod / rR, i, j); upd('A_real', l1 * (prod / rR - 1), i, j); upd('K_int', prod / rI, i, j); upd('A_int', l1 * (prod / rI - 1), i, j); blocks++; } } console.log(`primes to ${N} (${P.length}); blocks p_i < ${I} to the end, p_i >= ${I} over ${W} primes; ${blocks} blocks`); for (const [k, b] of Object.entries(best)) console.log(`${k.padEnd(6)} = ${b.v.toFixed(6)} at w1 = ${b.w1}, last prime ${b.pj}`); const K = best.K_real.v, Ki = best.K_int.v; console.log(`FI Lemma 6.8 positivity s > 9*kappa + 10 log K, kappa = 2:`); console.log(` real endpoints: 18 + 10 log K = ${(18 + 10 * Math.log(K)).toFixed(6)} -> s0 = max(19, that) = ${Math.max(19, 18 + 10 * Math.log(K)).toFixed(6)}`); console.log(` integer endpoints: 18 + 10 log K = ${(18 + 10 * Math.log(Ki)).toFixed(6)} -> s0 = ${Math.max(19, 18 + 10 * Math.log(Ki)).toFixed(6)}`); console.log(` K below which s0 = 19: e^0.1 = ${Math.exp(0.1).toFixed(6)}`); // Rescue check (W-trick): fix r mod W = prod_{p= w0, so // K(w0) = max over blocks with p_i >= w0. Blocks with p_i >= I are only W primes long. const suf = new Float64Array(P.length + 1); for (let i = P.length - 1; i >= 0; i--) suf[i] = Math.max(suf[i + 1], kI[i]); console.log(`K(w0) = sup over blocks starting at a prime >= w0 (real endpoints):`); for (const w0 of [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 97, 101, 211, 503, 1009, 10007]) { const i = P.findIndex(p => p >= w0); const K0 = suf[i]; console.log(` w0 = ${String(w0).padEnd(5)} K = ${K0.toFixed(6)} 18 + 10 log K = ${(18 + 10 * Math.log(K0)).toFixed(6)} s0 = ${Math.max(19, 18 + 10 * Math.log(K0)).toFixed(6)}`); } const first = P.findIndex((p, i) => suf[i] < Math.exp(0.1)); console.log(`smallest prime w0 with K(w0) < e^0.1 in this range: ${P[first]} (K = ${suf[first].toFixed(6)})`);