Inputs
Integer from 2 to 4096.
Approximate: several bit lengths share the same digit count. Bit length is used internally, and editing either field updates the other.
Try
Result
Probable prime
—
- Bit length
- —
- Decimal digits
- —
- Candidates tested
- —
- Additional MR rounds
- —
- Generation time
- —
How it works
- Draw a cryptographically random candidate of exactly the requested bit length, using
crypto.getRandomValues()— neverMath.random(). - Force the top bit to 1, so the candidate has exactly that many bits, and the bottom bit to 1, so it's odd.
- The shared test rejects candidates divisible by primes through 1000 and checks for exact squares.
- Below the documented bound it uses deterministic Miller–Rabin. Larger candidates use Baillie–PSW followed by 12 random Miller–Rabin rounds.
- A failed candidate is discarded; the first one that passes is returned.
For arbitrary-size results, passing these tests is strong evidence of primality, not a general mathematical proof.
Generation details
| Round | Witness a | Result |
|---|