Verifiable quantum circuit compilation · invsqrt task

Inside invsqrt

The circuit must multiply each basis state |x⟩ by the phase e2πi/√x for every x from 1 to 3,133,452, and hand x back untouched with every scratch qubit at zero. Pick an x and follow it through all 47,248 operations on 62 qubits: where its bits go, which stages do the work, where the qubit budget peaks, and how the phase builds up to its target.

|x⟩|0…0⟩ → exp(2πi · 1/√x) |x⟩|0…0⟩ tolerance 2⁻²⁴/√x turns
Try
Measurement outcomes

The whole circuit

Zoom: pinch, Ctrl or ⌘ + scroll, the buttons, or + − (0 for the whole circuit). Pan: drag, scroll sideways or Shift + scroll, or move the window in the overview strip. Click a stage band to zoom to that stage; click or tap a qubit's lane to highlight it. Follow, while zoomed in: Continuous keeps the playhead 30% of the way across and slides the trace under it, Page turns a page at the edge, Off leaves the view alone. Panning or zooming by hand while playing suspends following; F, the Follow button or Play catches up again.

op 0operation index →op 47,248
1, coloured by the phase so far (0 → 1 turn) 1 in the x register 1 in another qubit 0 0 here, but 1 for some other x (lifetime) Toffoli-class gates run measurement-based clean-ups (HMR/R) conditional ops skipped for this x gates that changed the phase playhead; when paused, the gate's wires are marked highlighted qubits (up to 4)

Bottom track: how many non-x qubits hold a 1 for this x; the faint red band is the maximum over 3,000 sampled x, with red ticks where it peaks (34 of 40). Holding a 1 is only a lower bound on being in use: a qubit carrying data can read 0.

Accumulated phase

The dial shows the phase as an angle: coloured hand = phase so far (at the playhead when it is paused), black tick = target 1/√x.

An HMR that reads 1 on a qubit holding 1 adds half a turn, and a later Z or CZ conditioned on that reading pays it back, so mid-circuit phases (the lookup's especially) flash as x changes. This toggle replays with every HMR outcome forced to 0: no kickback, no fix-ups, and the same final phase.

phase so far, in turns target 1/√x (mod 1) open phase debts: HMR records whose fix-ups are still to come of those, ones that kicked back for this x Mid-circuit the phase also carries measurement kickback that later stages repair, so only the end has to hit the target.

At the playhead

Keys: Space play or pause · ← → one op · Shift+← → Toffoli · [ ] stage · M next HMR · + − 0 zoom · F follow the playhead on or off. The address bar keeps this stop point (?op=…&x=…), the zoom window (&view=a-b), the follow mode (&follow=p or off; continuous is the default) and the highlighted qubits (&hl=…). The state shown is after the op at the playhead has run; render.py snapshot --op N --x X gives the same JSON.

Qubit groups

GroupQubitsRole

Precision across every x

x = 1x, log scale →3,133,452

Error ÷ tolerance for all 3,133,452 inputs, computed with kickmix. Each column shows the range within a slice of x. Inside ±1 passes. Click the curve to load that x.

What would it cost to build?

For fun, and very roughly. This circuit is tiny by quantum-algorithm standards, but running it on real hardware needs error correction, and that multiplies everything. Move the sliders; every number below is an assumption, not a quote.

Physical qubits per logical qubit ≈ 2d². Higher d means fewer errors and more qubits.
Extra space for moving logical qubits around (lattice surgery).
Each one makes the resource states Toffoli gates consume, one Toffoli's worth per d rounds; about 3,000 physical qubits apiece assumed. More factories, faster shots.
A rough 2026 order of magnitude for a superconducting system with cryogenics and control electronics, $10k to $200k (log scale).
One surface-code round: about 1 µs for superconducting qubits, about 1 ms for neutral atoms. Shot time ≈ Toffolis ÷ factories × d rounds.
Capital cost, roughly
–

Reference points, approximate: Google's Willow chip has 105 physical qubits (2024), IBM's Condor 1,121 (2023), and a 2025 Caltech neutral-atom array held about 6,100 atoms. None runs error-corrected logic at this scale yet. Meanwhile kickmix checks every input on a laptop in about 75 seconds.

The 17 stages

Toffolis run and net phase change are for the current x; the bar shows run against the static count.

StageOpsToffolisRun for xMeasurementsNet phase (turns)Evidence