MR witness-fraction scan (brute force, exact)
⚠ Couldn't start the canvas2D canvas context failed to initialize. Reload the page.
log₁₀(false-positive rate) vs rounds k — empirical vs 4⁻ᵏ bound

Miller–Rabin Witness Density & Convergence (2D)

This is the 2D companion to the 3D Miller-Rabin primality-test simulator, and it deliberately computes a different, more exhaustive view of the same algorithm rather than animating a single random round. For every odd number across a chosen range it brute-force checks every candidate base a ∈ [2, n−2] and computes the exact fraction that are true witnesses to compositeness — turning the textbook guarantee that at least three quarters of all bases expose a composite number into a real, measured curve plotted against that 0.75 threshold. Loading the classic Carmichael number 561 shows the contrast this scan is built to reveal: restricted to bases coprime to n, the weaker Fermat test's witness fraction collapses to essentially zero — the entire reason Carmichael numbers exist — while Miller-Rabin's witness fraction over the same n stays comfortably above 0.75, because its modular squaring chain checks for nontrivial square roots of 1 that Fermat's test cannot see. A second panel then runs a live Monte Carlo experiment: sampling real composite numbers from the scanned range, running k independent randomized rounds thousands of times, and plotting the measured false-positive rate directly against the theoretical 4−k ceiling that the same test relies on when it selects large primes for RSA keys.