Safe Prime Checker
Check whether p is prime and (p−1)/2 is prime, with p capped at 10¹² for bounded trial division.
Description
A safe prime p has a prime half-predecessor (p−1)/2.
A safe prime p has a prime half-predecessor (p−1)/2. That half-predecessor is the associated Sophie Germain prime.1
The tool returns isSafePrime. The indexing and output conventions below determine how to read these values.
When to use Safe Prime Checker
Use this for the following task: Check whether p is prime and (p−1)/2 is prime, with p capped at 10¹² for bounded trial division. Use the input and output conventions below to reproduce the intended mathematical quantity.
How to use Safe Prime Checker and understand its results
- Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
- Enter p according to the field table, then run the tool.
- Read isSafePrime. A true flag means the candidate meets the stated property; false means it does not.
- If the flag is false, review the candidate and definition. A well-formed nonmember is different from a rejected input.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| p | Candidate prime (trial-division resource limit 10^12) | integer; minimum 0; maximum 1000000000000 | Required |
Test primality of p and the derived half-predecessor using deterministic integer checks. Nonprime or noninteger derived candidates fail the predicate.
safePrime(p) ⇔ prime(p) AND prime((p−1)/2) The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| isSafePrime | Whether p is a safe prime | boolean |
{
"input": {
"p": 23
},
"output": {
"isSafePrime": true
}
} Limitations and assumptions
The candidate is at most 10¹². This mathematical property alone does not select cryptographic parameters or generate a random prime.
Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.
Alternative or Complementary methods
Choose Sophie Germain Prime Checker when you need its operation: Check whether both p and 2p+1 are prime by deterministic trial division, with p capped at 10¹² for bounded work. Choose Wieferich Prime Checker for the complementary operation: Check whether p is prime and 2^(p−1)≡1 (mod p²) with exact modular arithmetic; primality testing is limited to p≤10¹².
Background reference: OEIS A005385.
References
-
OEIS A005385 — OEIS Foundation
Similar or alternative tools
- Sophie Germain Prime Checker
Check whether both p and 2p+1 are prime by deterministic trial division, with p capped at 10¹² for bounded work.
- Wieferich Prime Checker
Check whether p is prime and 2^(p−1)≡1 (mod p²) with exact modular arithmetic; primality testing is limited to p≤10¹².