A curated transcript of the conversation (with Claude Code) that produced the Gilbreath array explorer for tao-web — a visual companion to the paper "Gilbreath's conjecture: a Cramér random model and a deterministic analysis" — from first sketch to publication.
How to read this. As with the spacetime applet's transcript, the point is to convey the process:
- Terence's messages are shown, mostly verbatim (a couple of one-word "continue" replies are folded into the narration).
- Claude's replies — the actual code edits to two files,
gilbreath.js(numeric core) andgilbreath.html(the app) — are replaced by short italic summaries of what changed. - Meta-conversation (requests to write this transcript, unrelated site edits) is left out.
The whole app was built in a single sitting, stage by stage, kept uncommitted for local testing until it was ready to publish. The numeric core was checked with headless Node unit tests throughout, and the UI wiring with a small DOM-shim smoke test.
1. The idea, and a plan
Terence (with the paper's PDF attached):
I'd like to create a new app (again, tested locally before pushing), meant to illustrate the Gilbreath conjecture and various random models (see my enclosed paper for background). The app will display a Gilbreath array of length N (where N is settable by the user, maybe defaulting at N=5 initially), where the top row are editable text boxes (that can take in natural number, integer, or real input) and all subsequent rows of the Gilbreath array are auto-generated and auto-updated. Additional statistics such as the mean and maximal value of each row should also be auto-provided. A choice of coloring schemes can be offered: no color scheme, parity coloring (even and odd colored differently, non-integers a neutral color), magnitude coloring (a cell of value x colored according to the integer part of |x|). A dropdown can select how the top row is chosen, as per the paper: (a) the first N primes; (b) the first N prime gaps; (c) the first N normalized prime gaps; (d) independent uniform random variables from 0 to m−1 (m from a text box); (e) independent geometric random variables of mean lambda; and (f) independent exponential real variables of mean lambda. For the random examples one can have a "regenerate" button to resample (also triggered whenever parameters such as N or lambda are modified). Can you plan out how to generate this app in stages? It should be simpler than the relativity app, so maybe fewer stages are needed.
Claude proposed reusing the site's applet infrastructure and, as with the relativity app, putting a pure DOM-free numeric core in its own gilbreath.js so it could be unit-tested headlessly. It flagged a few math subtleties to settle up front (the normalized-gap convention, and how to parameterize the geometric/exponential variables), and laid out a five-stage plan: (0) numeric core + tests, (1) editable grid, (2) generators, (3) colouring + a live Gilbreath read-out, (3.5) a canvas view for large N, (4) polish + publish. It asked two questions: how to render the triangle (and at what scale), and whether to include a "left diagonal" feature that actually checks the conjecture.
Terence chose an editable HTML grid plus a canvas view for large N, and yes, include the left-diagonal Gilbreath check — so the app would demonstrate the conjecture, not just display arrays.
Terence (catching a discrepancy in Claude's plan):
Oops, good catch on the inconsistent normalization. Please use the normalization from the paper (the app is intended as a visual aid for the paper). Since the paper uses p as the primary variable for the geometric variables instead of lambda, let's use p instead there.
Claude adopted the paper's exact conventions — normalized gaps (p_{k+1} − p_k)/2 − 1, and geometric variables by parameter p (with P(a=k) = (1−p)^k p) — then built Stage 0: the numeric core (prime sieve, the six generators, the absolute-difference array, row statistics, the colour classifiers, and a seedable PRNG) with a headless test suite that reproduces the paper's own worked examples (the first-six-primes array and the nine normalized gaps 0,0,1,0,1,0,1,2,0).
2. Stage 1 — the editable grid
Claude built the triangular HTML grid: a settable N, an editable top row seeded with the first N primes, every lower row auto-computed as absolute differences and re-rendered live on any edit, a per-row mean/max stats rail, auto-sizing cells, and horizontal scrolling. The rows are centred so they stagger Pascal-style into the triangle.
Terence:
Stage 1 looks good so far! Let's continue.
3. Stage 2 — the generators
Claude added the top-row generator dropdown — first primes, prime gaps, normalized gaps, uniform, geometric (parameter p), exponential (mean λ), and Custom — with parameter boxes that appear only for the relevant generator, a Regenerate button for the random ones, auto-resampling when N or a parameter changes, and "edit any cell → Custom mode". Verified with a DOM-shim smoke test driving every generator.
Terence:
Looks good! The only quibble is that the text uses all caps (so lower case lambda becomes Lambda, etc.). Is it possible to switch to a lower case (and maybe a mathy italic font) for the math symbols?
The control labels used text-transform: uppercase, which was turning the lowercase λ / p / m into Λ / P / M. Claude wrapped each math variable in a .var span that opts out of the uppercasing and renders in an italic serif math face.
4. Stage 3 — colouring and the Gilbreath check
Told to proceed, Claude added the three colouring schemes (None / Parity / Magnitude) with a legend, and the left-diagonal feature: a "highlight & check" toggle that rings each lower row's leftmost cell and shows a live read-out — "all 1s — Gilbreath's conjecture holds" (green), or a warning that the diagonal is stuck in {0,1} / leaves {0,1} at a given row.
Terence:
One can hide the regenerate button when a random model is not selected. I guess one can also have "all zeroes" as a (very boring) dropdown option, and "uniform even" or "uniform odd" from 0 to m−1 (disallowing any m that is too small for this random variable to be well-defined) to illustrate the parity obstruction that can prevent entries from reaching 1.
Claude hid (rather than disabled) the Regenerate button for non-random models, and added three generators. Uniform even and uniform odd are the star turn: since every entry stays even (odd top rows go even from the second row on), the whole array is trapped in the even integers and the left diagonal can never reach 1 — the 2-separated-set parity obstruction from the paper, now visible live. The m box is guarded so the variable is well-defined (uniform-odd forces m ≥ 2).
5. Stage 3.5 — the canvas
Terence:
Looks great! Let's do 3.5, I'm interested in seeing what the large canvas looks like.
Claude added the canvas large-N view: a Grid/Canvas toggle that, in canvas mode, hides the editable grid and draws the whole triangle as coloured cells (raising the N cap from 40 to 512), with the left diagonal stroked in accent and the Gilbreath read-out still live. This is where the {0,d}-block and Sierpinski structure from the paper's figures becomes visible at a glance.
6. Stage 4 — publish, the paper, and a spike
Terence:
The Canvas looks great! Let's do Stage 4. The Gilbreath paper appeared on the arXiv recently, and I wrote a discussion blog post. While you're waiting for the app to build, can you add a new paper entry to tao-web for this paper (which is to be submitted), and add links to the arXiv and blog post on the app? Actually I guess the paper YAML can acquire a new entry for an applet link, next to the arXiv and discussion links; going forward I can imagine implementing other visualization tools for my future papers.
Claude wrote the app's intro text (linking the arXiv preprint and the blog discussion), catalogued the app under a new "Number theory" category, and added the paper to the works database. To let the paper link back to its companion tool, it introduced a general applet link type (rendered as "interactive tool") — so the paper and the app now cross-reference each other, a pattern any future paper can reuse.
Terence (mid-build):
A spike sounds like another good idea for a custom initial data: some initial value d at some position n, with everyone else set to zero, with d and n settable as text boxes.
Claude added the single spike generator — value d at position n, zero elsewhere. With d = 1 the array is Pascal's triangle, so parity colouring draws a Sierpinski gasket (exactly the paper's single-non-zero-entry example). It also added a small Examples dropdown of one-click configurations drawn from the paper: normalized gaps collapsing to all-1s, the Sierpinski spike, the parity obstruction, and the Cramér (geometric) model.
The app was then published — validated, built, committed, pushed, and confirmed live — alongside the new paper entry.
From "illustrate the Gilbreath conjecture" to a published tool: an editable difference-triangle with prime, gap, spike, and random-model generators, parity/magnitude colouring, a live check of the conjecture on the left diagonal, and a large-N canvas that surfaces the fractal block structure — a companion to the paper, and cross-linked with it.