// hl_ratio.mjs: ratios of published prime-pair counts pi_h(10^n) (OEIS A007508 h=2, A080840 h=4, A080841 h=6; // pairs counted by upper member < 10^n) to S(h) N/ln^2 N and to S(h) Li2(N), Li2(N) = int_2^N dt/ln^2 t. // Deterministic; stdout is the artifact. Usage: node hl_ratio.mjs const C2 = 0.6601618158468696; // twin prime constant (externally reported, OEIS A005597) const S = { 2: 2 * C2, 4: 2 * C2, 6: 4 * C2 }; const counts = { 2: [8169, 58980, 440312, 3424506, 27412679, 224376048, 1870585220], 4: [8144, 58622, 440258, 3424680, 27409999, 224373161, 1870585459], 6: [16386, 117207, 879908, 6849047, 54818296, 448725003, 3741217498], }; // Li2 by Simpson in u = ln t: int_{ln2}^{lnN} e^u / u^2 du function li2(N) { const a = Math.log(2), b = Math.log(N), n = 200000, h = (b - a) / n; let s = 0; for (let i = 0; i <= n; i++) { const u = a + i * h, f = Math.exp(u) / (u * u); s += (i === 0 || i === n) ? f : (i % 2 ? 4 * f : 2 * f); } return s * h / 3; } console.log('h\tN\tpi_h\tpi_h/(S N/L^2)\tpi_h/(S Li2)\t(S Li2)/(S N/L^2)\t1+2/L+6/L^2+24/L^3'); for (const h of [2, 4, 6]) counts[h].forEach((c, i) => { const N = 10 ** (i + 6), L = Math.log(N), crude = S[h] * N / L / L, hl = S[h] * li2(N); console.log([h, `1e${i + 6}`, c, (c / crude).toFixed(5), (c / hl).toFixed(6), (hl / crude).toFixed(5), (1 + 2 / L + 6 / L / L + 24 / L ** 3).toFixed(5)].join('\t')); });