// CHEN SIGNED TARGET: heuristic limits of every component under the // singular-series (Bateman-Horn) model on z-rough partners, z = x^(1/8), r = x^(1/3). // HEURISTIC ONLY. Model: sum_{m in S, m in [x/2,x]} Lambda(m-2) ~ 2 C2 #S for any // set S of z-rough m defined by its factorization pattern (local factors at q >= z -> 1). // Units: H = C2 x / (2 log z) = 4 C2 x / log x, as in research/chen-fold-benchmark.md. // Then T_Lambda/H -> 1/4 and a pattern family of relative density D (primes: D = 1) // contributes D/4. // Densities: squarefree m with j factors x^(t_i), all t_i >= 1/8, sum t = 1, have relative // density phi^{*j}(1)/j!, phi(t) = 1/t on [1/8,1]; split phi = phiS (t <= 1/3) + phiL. // Checks: sum_j D_j = 8*omega(8) (Buchstab, solved independently), D_2 = log 7, and the // b-family density D_{3,k=1} = J of (8), J integrated directly. 'use strict'; const assert = require('node:assert/strict'); function run(N) { assert(N % 24 === 0); const a = N / 8, c = N / 3; const phiS = new Float64Array(N + 1), phiL = new Float64Array(N + 1); for (let i = a; i <= N; i++) { const v = N / i; if (i < c) phiS[i] = v; else if (i > c) phiL[i] = v; } phiS[a] /= 2; // jump at 1/8: mid value phiS[c] = N / c / 2; phiL[c] = N / c / 2; // jump at 1/3 split in halves const h = 1 / N; function conv(f, g) { // trapezoid on [0,s], s = n/N const out = new Float64Array(N + 1); for (let n = 0; n <= N; n++) { let acc = 0; for (let i = 0; i <= n; i++) { const w = (i === 0 || i === n) ? 0.5 : 1; const fi = f[i]; if (fi === 0) continue; acc += w * fi * g[n - i]; } out[n] = acc * h; } return out; } // powers of phiS up to 8, phiL up to 2 const S = [null, phiS]; for (let k = 2; k <= 8; k++) S[k] = conv(S[k - 1], phiS); const L = [null, phiL, conv(phiL, phiL)]; const fact = n => (n <= 1 ? 1 : n * fact(n - 1)); const binom = (n, k) => fact(n) / (fact(k) * fact(n - k)); const P = {}; // P[j][k] relative density, k = #factors <= x^(1/3) for (let j = 1; j <= 8; j++) { P[j] = new Array(j + 1).fill(0); for (let k = 0; k <= j; k++) { const m = j - k; if (m > 2) continue; // three factors above x^(1/3) exceed x let val; if (k === 0) val = L[m][N]; else if (m === 0) val = S[k][N]; else val = conv(S[k], L[m])[N]; P[j][k] = binom(j, k) * val / fact(j); } } return P; } function buchstabOmega(u, M) { // (u omega)' = omega(u-1), omega = 1/u on [1,2] const n = Math.round((u - 1) * M), om = new Float64Array(n + 1); for (let i = 0; i <= n; i++) { const v = 1 + i / M; if (v <= 2) om[i] = 1 / v; } const cum = new Float64Array(n + 1); // cum[i] = int_1^{1+i/M} omega for (let i = 1; i <= M; i++) cum[i] = cum[i - 1] + (om[i - 1] + om[i]) / (2 * M); for (let i = M + 1; i <= n; i++) { const v = 1 + i / M; om[i] = (1 + cum[i - M]) / v; // u omega(u) = 1 + int_1^{u-1} omega cum[i] = cum[i - 1] + (om[i - 1] + om[i]) / (2 * M); } return om[n]; } function Jdirect(n) { // Simpson, smooth integrand const f = t => Math.log(2 - 3 * t) / (t * (1 - t)); const lo = 1 / 8, hi = 1 / 3, hh = (hi - lo) / n; let s = f(lo) + f(hi); for (let i = 1; i < n; i++) s += (i % 2 ? 4 : 2) * f(lo + i * hh); return s * hh / 3; } function stats(P) { let Dtot = 0, A2 = 0, R1 = 0, R2 = 0, L = 0; for (let j = 1; j <= 8; j++) for (let k = 0; k <= j; k++) { const d = P[j][k]; if (!d) continue; const lam = j % 2 ? -1 : 1; const b = (j === 3 && k === 1) ? 1 : 0; Dtot += d; A2 += k * d; R1 += lam * d; R2 += lam * k * d; if (j >= 3 && j % 2) L += (k / 2 + b / 2 - 1) * d; // -W on odd composites } const A3 = P[3][1]; const Q = Dtot - A2 / 2 - A3 / 2; // squares: density 0 const R = R1 - R2 / 2 + A3 / 2; const K = R1 - R2 / 2; const T = P[1][0]; const u = v => v / 4; // to H units return { T: u(T), A1: u(Dtot), A2: u(A2), A3: u(A3), R1: u(R1), R2: u(R2), K: u(K), L: u(L), Q: u(Q), R: u(R), QmR: u(Q - R), twoTmL: u(2 * (T - L)), LoverT: L / T, etaStar: (Q - R) / Q, D: P }; } const Ns = [4800, 9600, 19200]; const res = Ns.map(N => stats(run(N))); const fmt = v => v.toFixed(7); const keys = ['T', 'A1', 'A2', 'A3', 'R1', 'R2', 'K', 'L', 'Q', 'R', 'QmR', 'twoTmL', 'LoverT', 'etaStar']; console.log('heuristic limits in units H = 4 C2 x / log x (LoverT, etaStar are ratios); columns N = ' + Ns.join(', ') + ', Richardson(h^2)'); const rich = {}; for (const key of keys) { const [r1, r2, r3] = res.map(r => r[key]); rich[key] = r3 + (r3 - r2) / 3; console.log(`${key.padEnd(8)} ${fmt(r1)} ${fmt(r2)} ${fmt(r3)} -> ${fmt(rich[key])}`); } const last = res[2].D; console.log('relative densities D_j (sum over k), N = ' + Ns[2] + ':'); for (let j = 1; j <= 8; j++) console.log(` j=${j} D=${last[j].reduce((s, v) => s + v, 0).toExponential(6)} by k: ${last[j].map(v => v.toExponential(3)).join(' ')}`); const om8 = buchstabOmega(8, 20000); const Dsum = 4 * rich.A1; console.log(`check: sum_j D_j = ${Dsum.toFixed(7)} vs 8*omega(8) = ${(8 * om8).toFixed(7)} (omega(8) = ${om8.toFixed(9)}, e^-gamma = 0.561459484)`); console.log(`check: D_2 = ${last[2].reduce((s, v) => s + v, 0).toFixed(7)} vs log 7 = ${Math.log(7).toFixed(7)}`); console.log(`check: D_{3,k=1} = ${(4 * rich.A3).toFixed(7)} vs J direct = ${Jdirect(20000).toFixed(7)}`); console.log(`identity: Q-R = ${fmt(rich.QmR)} vs 2(T-L) = ${fmt(rich.twoTmL)}`); const J = Jdirect(20000); console.log(`classical bounds (H units): A1 >= log3 = ${Math.log(3).toFixed(7)}, A2 <= log6 = ${Math.log(6).toFixed(7)}, A3 <= J = ${J.toFixed(7)}`); console.log(`separate-bound coefficient with K = 0: (1/2)log(3/2) - J = ${(Math.log(1.5) / 2 - J).toFixed(7)}`); console.error(`one-sided K needed with classical bounds: K <= (1/2)log(3/2) - J - eta*Q i.e. K <= ${(Math.log(1.5) / 2 - J).toFixed(7)} - eta*Q`); console.log(`heuristic K = ${fmt(rich.K)}; heuristic slack of that one-sided target at zero margin: ${(Math.log(1.5) / 2 - J - rich.K).toFixed(7)}`); // --------------------------------------------------------------------------- // Independent check of the signed densities by a delay equation, not by convolution. // E(s) = sum_{j>=1} (-1)^j phi^{*j}(s)/j! satisfies s E(s) = -1 - int_0^{s-a} E(u) du (s >= a), // E = 0 below a = 1/8. Then R1-density = E(1), R2-density = -int_{1/8}^{1/3} E(1-t)/t dt. function lambdaRough(M) { const n = M, a = M / 8, E = new Float64Array(n + 1), cum = new Float64Array(n + 1); for (let i = 1; i <= n; i++) { const s = i / M; if (i >= a) { const j = i - a; // int_0^{s-a} E E[i] = (-1 - cum[j]) / s; if (i === a) E[i] = -8; // value at the jump taken from the right } cum[i] = cum[i - 1] + ((i - 1 >= a ? E[i - 1] : 0) + E[i]) / (2 * M); } return E; } { const out = []; for (const M of [96000, 192000]) { const E = lambdaRough(M); const R1d = E[M]; let R2d = 0; const lo = M / 8, hi = M / 3; for (let i = lo; i <= hi; i++) { const w = (i === lo || i === hi) ? 0.5 : 1; R2d -= w * E[M - i] / (i / M) / M; } out.push([R1d / 4, R2d / 4]); } const [a1, a2] = out; console.log(`DDE check (H units), M = 96000, 192000: R1 ${a1[0].toExponential(4)} ${a2[0].toExponential(4)}; R2 ${a1[1].toExponential(4)} ${a2[1].toExponential(4)}; K ${(a1[0] - a1[1] / 2).toExponential(4)} ${(a2[0] - a2[1] / 2).toExponential(4)}`); } // --------------------------------------------------------------------------- // Pricing the separate-bound budget at a level of distribution theta for the two unsigned // sequences (shifted primes; the switched triple-product sequence). theta = 1/2 is BV and // reproduces (7)-(8); theta > 1/2 is CONDITIONAL on an Elliott-Halberstam-type input. // Linear sieve: F = 2e^g/s (s <= 3), f = 0 (s <= 2), (sF)' = f(s-1) (s > 3), (sf)' = F(s-1) (s > 2). const eg = Math.exp(0.5772156649015329); const MS = 20000, SMAX = 10; const Fs = new Float64Array(SMAX * MS + 1), fs_ = new Float64Array(SMAX * MS + 1); for (let i = 1; i <= SMAX * MS; i++) { const s = i / MS; if (s <= 3) Fs[i] = 2 * eg / s; if (s > 2 && s <= 4) fs_[i] = 2 * eg * Math.log(s - 1) / s; } let sFacc = 3 * Fs[3 * MS], sfacc = 4 * fs_[4 * MS]; for (let i = 3 * MS + 1; i <= SMAX * MS; i++) { const s = i / MS; if (i > 4 * MS) { sfacc += (Fs[i - 1 - MS] + Fs[i - MS]) / (2 * MS); fs_[i] = sfacc / s; } sFacc += (fs_[i - 1 - MS] + fs_[i - MS]) / (2 * MS); Fs[i] = sFacc / s; } const interp = (arr, s) => { const x = s * MS, i = Math.floor(x), u = x - i; return arr[i] * (1 - u) + arr[i + 1] * u; }; const Jv = Jdirect(20000); function budget(theta) { const A1 = 2 / eg * interp(fs_, 8 * theta); let A2 = 0; const n = 4000, lo = 1 / 8, hi = 1 / 3, hh = (hi - lo) / n; for (let i = 0; i <= n; i++) { const t = lo + i * hh, w = (i === 0 || i === n) ? 1 : (i % 2 ? 4 : 2); A2 += w * interp(Fs, 8 * (theta - t)) / t; } A2 *= (2 / eg) * hh / 3; const A3 = Jv / (2 * theta); return { A1, A2, A3, c: A1 - A2 / 2 - A3 }; } console.log(`sieve functions: F(3)=${interp(Fs, 3).toFixed(6)} f(4)=${interp(fs_, 4).toFixed(6)} F(6)=${interp(Fs, 6).toFixed(6)} f(6)=${interp(fs_, 6).toFixed(6)} F(8)=${interp(Fs, 8).toFixed(6)} f(8)=${interp(fs_, 8).toFixed(6)}`); const b05 = budget(0.5); console.log(`theta=1/2 reproduces the benchmark: A1 ${b05.A1.toFixed(6)} (log3 ${Math.log(3).toFixed(6)}), A2 ${b05.A2.toFixed(6)} (log6 ${Math.log(6).toFixed(6)}), A3 ${b05.A3.toFixed(6)} (J), c ${b05.c.toFixed(6)}`); console.log('theta A1_low A2_up A3_up c(theta) = A1 - A2/2 - A3 [model truth: A1 1.122919 A2 1.101392 A3 0.090771, c_true(K=0) 0.481573]'); for (const th of [0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.9, 1.0]) { const b = budget(th); console.log(`${th.toFixed(2)} ${b.A1.toFixed(6)} ${b.A2.toFixed(6)} ${b.A3.toFixed(6)} ${b.c.toFixed(6)}`); } let lo = 0.5, hi = 1.0; for (let it = 0; it < 60; it++) { const mid = (lo + hi) / 2; if (budget(mid).c < 0) lo = mid; else hi = mid; } console.log(`theta* where c(theta) = 0 (K bound 0): ${((lo + hi) / 2).toFixed(6)}`);