Residue ring (mod n) Round passed (probable prime) Witness found (composite)
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Miller–Rabin Primality Test

Every RSA key pair starts with two large primes, and finding them at scale means testing thousands of random odd numbers with a probabilistic algorithm rather than trial division. This simulator runs the real Miller–Rabin test: pick an n, write n − 1 = 2r·d, and watch the modular squaring chain for each random base spiral around a 3D ring representing arithmetic mod n. A round that lands on ±1 at the right step passes as "probably prime"; a round that squares into a nontrivial root of 1 exposes n as composite outright, and the base becomes a witness. Run enough independent rounds and the false-positive probability collapses below 4−k — the same guarantee that lets real cryptographic libraries trust a "probable prime" enough to build a key from it.