The Birch and Swinnerton-Dyer conjecture
Certify ranks of elliptic curves exactly, check what 2026 claimed about BSD, and push the range where the full formula is proved past conductor 5000

| 1 | // docs/edsac.svg: Birch and Swinnerton-Dyer's experiment, redone. For the curve of least known conductor of each rank 0 |
| 2 | // to 5, the product over good primes p <= X of N_p / p (N_p: the points mod p, the one at infinity included) against X |
| 3 | // on log log axes, where a curve's slope tends to its rank. Each line is labelled with its rank and its slope fitted over |
| 4 | // X = 1,000 to 100,000. Light or dark as the reader's system is. About 20 s. |
| 5 | // node scripts/edsac-figure.mjs > docs/edsac.svg |
| 6 | // The counting is the same as the column's playground (public/millennium/bsd-edsac.html on the site). |
| 7 | |
| 8 | const TOP = 100000, LO = 1000 |
| 9 | const CURVES = [ // label, [a1, a2, a3, a4, a6], rank: Cremona's tables, and the LMFDB for 19047851.a1 |
| 10 | ['11a1', [0, -1, 1, -10, -20], 0], ['37a1', [0, 0, 1, -1, 0], 1], ['389a1', [0, 1, 1, -2, 0], 2], |
| 11 | ['5077a1', [0, 0, 1, -7, 6], 3], ['234446a1', [1, -1, 0, -79, 289], 4], ['19047851a1', [0, 0, 1, -79, 342], 5]] |
| 12 | |
| 13 | function primes(n) { const s = new Uint8Array(n + 1), out = []; for (let i = 2; i <= n; i++) if (!s[i]) { out.push(i); for (let j = i * i; j <= n; j += i) s[j] = 1 } return out } |
| 14 | const mod = (a, p) => ((a % p) + p) % p |
| 15 | // N_p for y^2 + a1 xy + a3 y = x^3 + a2 x^2 + a4 x + a6 at an odd good prime: (2y + a1 x + a3)^2 = f(x) = |
| 16 | // 4x^3 + b2 x^2 + 2 b4 x + b6, so N_p = p + 1 + sum over x of the Legendre symbol of f(x), f stepped by differences |
| 17 | function count([a1, a2, a3, a4, a6], p, sq) { |
| 18 | const b2 = mod(a1 * a1 + 4 * a2, p), b4 = mod(2 * a4 + a1 * a3, p), b6 = mod(a3 * a3 + 4 * a6, p) |
| 19 | sq.fill(0, 0, p) |
| 20 | for (let x = 1, y = 1; x <= (p - 1) / 2; x++) { sq[y] = 1; y += 2 * x + 1; while (y >= p) y -= p } |
| 21 | let F = b6, D1 = mod(4 + b2 + 2 * b4, p), D2 = mod(24 + 2 * b2, p), s = 0 |
| 22 | const D3 = 24 % p |
| 23 | for (let x = 0; x < p; x++) { |
| 24 | if (F) s += sq[F] ? 1 : -1 |
| 25 | F += D1; if (F >= p) F -= p |
| 26 | D1 += D2; if (D1 >= p) D1 -= p |
| 27 | D2 += D3; if (D2 >= p) D2 -= p |
| 28 | } |
| 29 | return p + 1 + s |
| 30 | } |
| 31 | function disc([a1, a2, a3, a4, a6]) { |
| 32 | const b2 = a1 * a1 + 4 * a2, b4 = 2 * a4 + a1 * a3, b6 = a3 * a3 + 4 * a6 |
| 33 | const b8 = a1 * a1 * a6 + 4 * a2 * a6 - a1 * a3 * a4 + a2 * a3 * a3 - a4 * a4 |
| 34 | return -b2 * b2 * b8 - 8 * b4 ** 3 - 27 * b6 * b6 + 9 * b2 * b4 * b6 // small coefficients: exact in doubles |
| 35 | } |
| 36 | function run(a) { |
| 37 | const sq = new Uint8Array(TOP + 1), D = disc(a), pts = [] |
| 38 | let lf = 0 |
| 39 | for (const p of primes(TOP)) { |
| 40 | if (p === 2 || D % p === 0) continue // p = 2 changes no slope; the bad primes are left out, as BSD's product does |
| 41 | lf += Math.log(count(a, p, sq) / p) |
| 42 | pts.push([p, lf]) |
| 43 | } |
| 44 | return pts |
| 45 | } |
| 46 | // the slope against log log X of the running sum sampled evenly in log X, as the 1960s plots were read |
| 47 | function slope(pts) { |
| 48 | const k = 120, xs = [], ys = [] |
| 49 | let j = 0 |
| 50 | for (let i = 0; i < k; i++) { |
| 51 | const x = LO * (TOP / LO) ** (i / (k - 1)) |
| 52 | while (j + 1 < pts.length && pts[j + 1][0] <= x) j++ |
| 53 | xs.push(Math.log(Math.log(x))); ys.push(pts[j][1]) |
| 54 | } |
| 55 | const mx = xs.reduce((a, b) => a + b) / k, my = ys.reduce((a, b) => a + b) / k |
| 56 | let sxy = 0, sxx = 0 |
| 57 | for (let i = 0; i < k; i++) { sxy += (xs[i] - mx) * (ys[i] - my); sxx += (xs[i] - mx) ** 2 } |
| 58 | return sxy / sxx |
| 59 | } |
| 60 | |
| 61 | const W = 720, H = 360, L = 46, R = W - 86, T = 12, B = H - 28 |
| 62 | const LIGHT = ['#9cc3cc', '#6fa6b4', '#3f879a', '#1f6d82', '#0b566a', '#03404f'], DARK = ['#3f6e79', '#4f8b99', '#68a8b6', '#8cc4d0', '#b3dde6', '#dff3f7'] |
| 63 | const X0 = Math.log(Math.log(10)), X1 = Math.log(Math.log(TOP)) |
| 64 | const X = x => L + (Math.log(Math.log(x)) - X0) / (X1 - X0) * (R - L) |
| 65 | const runs = CURVES.map(([label, a, rank]) => { const pts = run(a), s = slope(pts); console.error(label, 'rank', rank, 'slope', s.toFixed(3)); return { rank, pts, s } }) |
| 66 | const top = Math.ceil(Math.max(...runs.map(r => r.pts.at(-1)[1])) / Math.LN10) * Math.LN10 |
| 67 | const Y = v => B - Math.max(0, v) / top * (B - T) |
| 68 | const num = v => (Math.round(v * 10) / 10).toString() |
| 69 | const sup = n => String(n).replace(/[0-9]/g, d => '⁰¹²³⁴⁵⁶⁷⁸⁹'[d]) |
| 70 | const out = [`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W} ${H}" width="${W}" height="${H}" font-family="system-ui, -apple-system, 'Segoe UI', sans-serif" font-size="12">`, |
| 71 | '<title>Birch and Swinnerton-Dyer’s product for the smallest curves of rank 0 to 5</title>', |
| 72 | `<style>.bg{fill:#fff}.grid{stroke:#ebedf0}.axis{stroke:#dadce0}.t{fill:#5f6368}${LIGHT.map((c, i) => `.r${i}{stroke:${c}}.f${i}{fill:${c}}`).join('')}` + |
| 73 | `@media (prefers-color-scheme: dark){.bg{fill:#1f2023}.grid{stroke:#2e3033}.axis{stroke:#3c4043}.t{fill:#9aa0a6}${DARK.map((c, i) => `.r${i}{stroke:${c}}.f${i}{fill:${c}}`).join('')}}</style>`, |
| 74 | `<rect class="bg" width="${W}" height="${H}"/>`] |
| 75 | for (let e = 0; e * Math.LN10 <= top + 1e-9; e++) { const y = Math.round(Y(e * Math.LN10)) + 0.5; out.push(`<path class="grid" d="M${L} ${y}H${R}"/><text class="t" x="${L - 8}" y="${y + 4}" text-anchor="end">${e === 0 ? '1' : e === 1 ? '10' : '10' + sup(e)}</text>`) } |
| 76 | for (const [x, t] of [[10, '10'], [100, '100'], [1000, '1,000'], [1e5, '100,000']]) out.push(`<text class="t" x="${num(Math.min(R - 22, X(x)))}" y="${B + 18}" text-anchor="middle">${t}</text>`) |
| 77 | out.push(`<path class="axis" d="M${L} ${B + 0.5}H${R}"/><text class="t" x="${L + 6}" y="${T + 12}">∏ Nₚ/p</text><text class="t" x="${R}" y="${B - 6}" text-anchor="end">p ≤ X</text>`) |
| 78 | const lastY = [] |
| 79 | for (const { rank, pts, s } of runs) { // the running product sampled at 400 points evenly in log log X, a step at each prime |
| 80 | const d = [] |
| 81 | let j = 0 |
| 82 | for (let i = 0; i <= 400; i++) { |
| 83 | const x = Math.exp(Math.exp(X0 + (X1 - X0) * i / 400)) |
| 84 | while (j + 1 < pts.length && pts[j + 1][0] <= x) j++ |
| 85 | d.push(`${i ? 'L' : 'M'}${num(X(x))} ${num(Y(pts[j][0] <= x ? pts[j][1] : 0))}`) |
| 86 | } |
| 87 | out.push(`<path class="r${rank}" fill="none" stroke-width="${rank === 0 ? 1.6 : 1.8}" stroke-linejoin="round" d="${d.join('')}"/>`) |
| 88 | let ly = Y(pts.at(-1)[1]) + 4 |
| 89 | for (const o of lastY) if (Math.abs(o - ly) < 13) ly = o - 13 |
| 90 | lastY.push(ly) |
| 91 | out.push(`<text class="f${rank}" x="${R + 6}" y="${num(ly)}" font-weight="600">${rank} · ${s.toFixed(2)}</text>`) |
| 92 | } |
| 93 | out.push('</svg>') |
| 94 | console.log(out.join('\n')) |