1-hour hands-on · runs in your browser · no install
Program a quantum computer before your coffee gets cold.
A real state-vector simulator with a Qiskit-mirrored API. Learn the three ideas that make quantum different, then write circuits and watch Grover and Shor actually run — all offline, right here.
// Create a Bell pair — two entangled qubits
const qc = new QuantumCircuit(2);
qc.h(0); // put qubit 0 into superposition
qc.cx(0, 1); // entangle qubit 1 with qubit 0
qc.probabilities(); // → 50% |00⟩, 50% |11⟩, never |01⟩ or |10⟩
Why this matters
Some problems no classical machine will ever catch.
Where we stand
You already command staggering computing power.
Every system you've shipped runs on the bit — a switch that is 0 or 1. Stack a few billion on a chip, double them every couple of years, and you get the entire digital world: databases, graphics, the model answering you right now.
For the overwhelming majority of problems, this is enough — and it always will be. Nobody needs a quantum computer to serve a web page or sort a list. That's not the frontier.
The crack in the floor
Then there's the other pile of problems.
A pile where the work doubles every time you add one piece. Not 1% harder — twice as hard. Each new molecule, each new variable, each extra bit of a key.
To track a quantum system of
30particles, a classical computer must store
1,073,741,824
complex numbers — about a billion. Already a strain.
Drag it. Watch the number leave the universe behind.
Simulating a modest molecule for a new battery or drug. Searching a space with no shortcut. Factoring the number that guards your bank's encryption. These aren't badly-written programs — they're exponential by nature. No bigger datacenter rescues you; add a few dozen particles and you'd need more memory than there are atoms in the universe.
And yet a glass of water solves its own quantum equations effortlessly, billions of times a second. So maybe the problem isn't hard. Maybe our machine is built out of the wrong stuff.
A different unit of computation
What if a bit could be many things at once — and the possibilities could cancel?
That's the whole bet of quantum computing. Replace the bit with a qubit, and three new powers come online. Everything else today is detail.
🌗
Superposition
One qubit holds a blend of 0 and 1. n qubits hold all 2n combinations at once — 300 qubits is more states than atoms in the universe.
🔗
Entanglement
Qubits link so that measuring one instantly tells you about another — a correlation no classical wiring can reproduce.
🌊
Interference
Amplitudes are waves with sign. Steer them so wrong answers cancel and the right one is left standing loud.
Superposition gives you the parallelism. Interference is how you actually read out an answer instead of a random guess. Entanglement is the glue that makes multi-qubit algorithms possible. Master these three and you can read any quantum algorithm ever written.
The surprise for a developer: programming this looks a lot like code you already write. You build a circuit, gate by gate. Let's feel each idea, then write it.
Press the buttons. These tiny widgets run on the very same simulator you'll code against in the lab.
1 Superposition — a fair coin you can't predict
A classical bit is heads or tails. Apply a Hadamard (H) gate to |0⟩ and the qubit becomes a genuine 50/50 blend — not "we don't know yet", but actually both, until measured.
const qc = new QuantumCircuit(1);
qc.h(0); // |0⟩ → (|0⟩+|1⟩)/√2
qc.sample(1000); // measure 1000 times
—measured |0⟩
—measured |1⟩
2 Gates are rotations — meet the Bloch sphere
A single qubit's state is an arrow on a sphere. |0⟩ points up, |1⟩ down, superpositions around the equator. Every gate just rotates the arrow. Click gates and watch.
|ψ⟩ = |0⟩
Applied gates:
(none)
Notice: X flips up↔down (a NOT). H sends the pole to the equator (superposition). Z/S/T spin it around the vertical — invisible to measurement alone, but the engine behind interference.
3 Interference — two H's cancel back to certainty
If superposition were just "random", applying H twice would stay random. It doesn't. The two ways of reaching |1⟩ carry opposite signs and cancel — you land back on |0⟩ with certainty. That cancellation is the quantum advantage.
One H → coin flip. Two H's → guaranteed |0⟩. The middle "blur" interferes with itself.
4 Entanglement — two coins, one fate
h(0) then cx(0,1) builds a Bell pair. Measure 1000 times: you only ever see |00⟩ or |11⟩, in step, never |01⟩ or |10⟩ — even though each qubit alone is a perfect coin flip. No classical pair of coins can do this.
Add one qubit and the number of amplitudes the machine juggles doubles. That doubling is the whole prize — and the whole reason your laptop can only simulate a couple dozen qubits.
This very page bogs down past ~16 qubits. Real hardware doesn't store these numbers at all — it is the quantum system.
No typing needed. Pick a goal, click gates to drop them onto your qubits, and read what each one does as you go. Press Check when you think you've got it.
—
Your circuit: qc = QuantumCircuit(2) · edit the code below, or click a gate to add a line
What your code does, step by step
If you measured now, you'd see…
Show the circuit & details
Bloch arrow for qubit
The payoff
Grover & Shor, running for real
Two famous algorithms — a faster search and the code-breaker — built from the exact gates you just learned. Tweak them and watch.
🔎 Grover's search — find the needle in √N looks
Search 8 boxes (3 qubits) for one marked item. Classically you'd peek ~4 times on average; Grover needs ~2. The trick: an oracle flips the sign of the answer, then a diffuser reflects all amplitudes about their average — interference pumps probability into the marked state each round.
Read it as code:hAll → repeat[ oracle(mark) ; diffuser ]. Watch the marked bar climb, peak near the optimal iteration count, then — if you over-rotate — fall again. That overshoot is interference reminding you it's waves, not a database.
🔐 Shor's algorithm — factor 15 with quantum period-finding
RSA's security rests on factoring being hard. Shor turns factoring into finding the period of ax mod N, which a quantum computer does exponentially faster via phase estimation + inverse QFT. This runs the genuine circuit on 12 simulated qubits (8 counting + 4 work), measures, then does the classical continued-fraction step.
Counting-register measurements (peaks ≈ k·2⁸ / r)
Classical post-processing
Pick a base and press Run.
Reference
API cheatsheet
Everything the lab understands. Method names match IBM Qiskit so your fingers learn the real thing.
Setup & results
Call
What it does
new QuantumCircuit(n)
An n-qubit circuit, all qubits start in |0⟩. (In the lab, qc is already created for you.)
qc.probabilities()
Array of 2ⁿ measurement probabilities.
qc.state()
The full complex amplitude vector.
qc.sample(shots)
Simulate measuring shots times → counts per bitstring.
qc.bloch(q)
Bloch vector {x,y,z} of qubit q.
Single-qubit gates
qc.h(q)
Hadamard — make superposition
qc.x(q)
NOT / bit-flip (Pauli-X)
qc.y(q)qc.z(q)
Pauli-Y, Pauli-Z (phase flip)
qc.s(q)qc.t(q)
¼ and ⅛ phase turns (+ sdg,tdg)
qc.rx(θ,q)ryrz
Rotations by angle θ
qc.p(λ,q)
Phase gate — add phase λ to |1⟩
Multi-qubit gates
qc.cx(c,t)
CNOT — flip t if c is |1⟩
qc.cz(c,t)
Controlled-Z (phase flip on |11⟩)
qc.cp(λ,c,t)
Controlled phase
qc.swap(a,b)
Swap two qubits
qc.ccx(a,b,t)
Toffoli (CCNOT)
qc.mcx([..],t)
Multi-controlled X
qc.mcz([..])
Phase-flip the all-ones state (Grover)
qc.hAll()
H on every qubit
From here to real hardware
The same program in IBM Qiskit (Python):
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
print(Statevector(qc).probabilities_dict()) # {'00': 0.5, '11': 0.5}
Install with pip install qiskit, then submit to a free IBM Quantum backend with qiskit-ibm-runtime. Every gate name you used here exists there.
Built for a 1-hour hands-on session · self-contained, offline · simulator verified against Bell, GHZ, Grover & Shor.