Skip to content
MizanStack

Run a quantum computer demo on your laptop, free

In our video about quantum computers and RSA we ran three small experiments on a normal laptop. This page has every step and every file, so you can run them yourself in about 10 minutes. It is free, needs no account and no quantum computer: it all runs in a simulator on your machine.

What you will run

  • Demo 1, bell.py: two qubits get entangled, then measured 4096 times. About half the shots give 00 and half give 11, never 01 or 10.
  • Demo 2, noisy_sim.py: the same circuit on a simulated copy of a real IBM chip (ibm_kingston), with its noise. About 0.9% of the answers come out wrong. Then Shor on 15 with that noise: about 96% of the shots still land on the right peaks.
  • Demo 3, shor15.py: Shor's algorithm on the number 15. It finds the period 4, and plain math turns that into 15 = 3 x 5.
  • Honest limits: this is a simulation on your laptop, not a quantum computer. The Shor circuit is simplified because we already know the answer for 15, so it shows the shape of the algorithm, not a real break. Breaking RSA-2048 would need about a million qubits, not 8.

What you need

  • A laptop or desktop with macOS, Windows or Linux, and an internet connection for the install.
  • Python 3.11 (what we tested with; newer 3.x should work too). Get it from python.org (opens in a new tab). On Windows, tick "Add python.exe to PATH" in the installer.
  • About 10 minutes and about 1 GB of free space. No account and no money.

A terminal is the window where you type commands: Terminal on macOS, PowerShell on Windows, Terminal on Linux. To paste a command: Cmd + V on Mac, Ctrl + V on Windows, Ctrl + Shift + V on Linux.

Step 1: set up a clean folder

  1. Make a folder for the demo and go into it:

    mkdir quantum-demo && cd quantum-demo
  2. macOS or Linux: make a private Python environment (venv) and turn it on:

    python3 -m venv .venv && source .venv/bin/activate
  3. Windows (PowerShell): make the venv, then turn it on:

    py -m venv .venv
    .venv\Scripts\activate
  4. You know it worked when the line in your terminal starts with (.venv). Every next command runs inside it.

Step 2: install Qiskit

Qiskit is IBM's free toolkit for writing quantum programs. These are the exact versions we used in the video:

pip install qiskit==2.6.1 qiskit-aer==0.18.2 qiskit-ibm-runtime==0.51.0

It takes a minute or two. The same list is in requirements.txt (opens in a new tab). IBM's own install guide: Install Qiskit (opens in a new tab).

Step 3: get the three files

Download all three into your folder with one command (on Windows, type curl.exe instead of curl):

curl -O https://mizanstack.com/files/quantum/bell.py -O https://mizanstack.com/files/quantum/noisy_sim.py -O https://mizanstack.com/files/quantum/shor15.py

Or open them in your browser and save them: bell.py (opens in a new tab), noisy_sim.py (opens in a new tab), shor15.py (opens in a new tab).

Step 4: entangle two qubits

python bell.py
  • First it draws the circuit: H puts qubit 0 in superposition (0 and 1 at once), CNOT ties qubit 1 to it (entanglement), then both are measured.
  • Then it runs 4096 shots on a perfect simulator. You get about 50% 00 and 50% 11. The exact counts change a little every run; in the video it was 2027 and 2069.
  • You never get 01 or 10: the two qubits always agree. That is entanglement.

Step 5: the same thing with real-world noise

python noisy_sim.py
  • This uses FakeKingston: a copy of IBM's ibm_kingston chip with its published noise numbers. It runs offline. It is still a simulation of that machine, not the machine.
  • The Bell circuit now gives about 0.9% wrong answers (01 or 10). Real qubits make mistakes, and that is why big quantum computers are so hard to build.
  • Then Shor on 15 with the same noise: about 96% of the shots land on the right peaks (0, 4, 8, 12), and the period still comes out as 4. These two numbers repeat exactly, because the script fixes its random seed.

Step 6: Shor's algorithm on 15

python shor15.py
  • The circuit looks for the period of 2 to the power x, divided by 15: 1, 2, 4, 8, then 1, 2, 4, 8 again. The period is 4.
  • The strongest peaks are 0, 4, 8 and 12 out of 16, about 25% each. From the peak 12/16 the script finds the period r = 4.
  • Then normal math: gcd(2^2 - 1, 15) = 3 and gcd(2^2 + 1, 15) = 5, so 15 = 3 x 5.
  • Peter Shor published this algorithm in 1994 (paper (opens in a new tab)). IBM first ran it on 15 in 2001, on a 7-qubit machine (IBM (opens in a new tab)).

Optional: a real IBM quantum computer

The video did not use real hardware. If you want to try it, IBM has a free plan with a little machine time each month:

  1. Create a free IBM Quantum Platform account and save your API key once, following IBM's setup guide (opens in a new tab).

  2. Run the Bell demo on the least busy real machine. Your job may wait in a queue first:

    python bell.py --hardware

Expect a few percent of wrong answers, more than the noisy copy, because real calibration changes during the day. Keep your API key private, like a password.

Why your laptop stops at about 30 qubits

  • A simulator stores 2 to the power n numbers for n qubits, 16 bytes each. 30 qubits is about 17 GB of memory, 35 qubits about 550 GB. So a normal laptop tops out around 30.
  • An RSA-2048 key is about 617 digits long. The biggest RSA number broken on normal computers is 829 bits (RSA-250, in 2020).
  • Google's Craig Gidney estimated in 2025 that under a million noisy qubits could break RSA-2048 in under a week. That is a theoretical estimate: no machine that big exists today.
  • The fix is already rolling out: post-quantum cryptography. Cloudflare says about 70% of browser connections to it already use it (29 September 2026). AES-256, which protects the data itself, stays safe.

Sources

Checked on 30 October 2026 by running all three scripts in a fresh setup. Qiskit changes fast, so keep the versions above.