Sophie Germain Prime Finder

p and 2p+1 both prime

CalculatorsFreeNo Signup
4.9(370 reviews)
All Tools

Loading tool...

About Sophie Germain Prime Finder

A Sophie Germain prime finder locating primes p where 2p+1 (the 'safe prime') is also prime. Used in Diffie-Hellman key exchange for cryptographic security. Shows pairs, counts in range, and Cunningham chains. Client-side.

Sophie Germain Prime Finder Features

  • SG primes
  • Safe primes
  • Chain search
  • Count
  • Crypto use
Sophie Germain prime: p is prime and 2p+1 is also prime. Named for Sophie Germain who proved Fermat's Last Theorem for SG primes. 2p+1 is called a 'safe prime'. Used in Diffie-Hellman: safe primes ensure large cyclic subgroups. First: 2,3,5,11,23,29,41,53,83,89...

How to Use

Enter range:

  • SG primes: p where 2p+1 is prime
  • Safe primes: The 2p+1 values
  • Count: In range

Cryptographic Use

In Diffie-Hellman, we need prime p where (p−1)/2 is also prime. This is exactly 2q+1 where q is Sophie Germain. Ensures the multiplicative group has a large prime-order subgroup, preventing Pohlig-Hellman attacks.

Cunningham Chains

A chain of primes where each is 2×previous+1: p, 2p+1, 4p+3, 8p+7, ... The longest known chains have 19 elements. SG primes start chains of length ≥2.

Step-by-Step Instructions

  1. 1Enter upper bound.
  2. 2Find SG primes.
  3. 3View safe primes.
  4. 4Explore chains.
  5. 5Count results.

Sophie Germain Prime Finder — Frequently Asked Questions

Are there infinitely many Sophie Germain primes?+

Conjectured but unproven. Like twin primes, their density decreases: approximately C·n/(ln n)² SG primes below n, where C≈1.32 (the twin prime constant times 2). As of 2024, the largest known SG prime has over 388,000 digits.

Why are safe primes important in cryptography?+

For prime p=2q+1 (q SG prime): the multiplicative group mod p has order p−1=2q. Subgroups have order 1, 2, q, or 2q. The order-q subgroup is large and cyclic, making discrete log hard. Without safe primes, the group might have many small subgroups vulnerable to Pohlig-Hellman.

What are Cunningham chains?+

Type 1: p₁, p₂=2p₁+1, p₃=2p₂+1, ... (each is a safe prime of the previous). Type 2: p₁, p₂=2p₁−1, ... Longest known type-1 chain: 19 primes starting at 79444762569120160214207564014·2^n−1.

Share this tool: