Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a list of precomputed safe prime numbers. Where can I get such a list?

share|cite|improve this question
For ignorant people like me: – 1015 Mar 2 '13 at 16:24
Maybe you can get them from the same company that will supply you with suggested passwords for your bank account. – André Nicolas Mar 2 '13 at 17:38
@AndréNicolas All the smart people use correct horse battery staple. – Trevor Wilson Mar 2 '13 at 17:40
@AndréNicolas I don't intend on using them as private keys, but as part of Pohlig-Hellman exponentation cipher. The use of that algorithm will be the most interesting of the ones I have heard about yet. – ThePiachu Mar 2 '13 at 18:25

Here's a list of the first 10000 numbers

share|cite|improve this answer
^_^ ${}{}{}{}\;$ – Ricky Demer Sep 10 '13 at 10:01 ${}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}$

share|cite|improve this answer

With a little haskell, you can generate what you want.

ld n = ldf 2 n

ldf k n | rem n k == 0 = k
        | k^2 > n      = n
        | otherwise    = ldf (k+1) n

isprime n = isprime' (abs n)

isprime' n
  | n < 2 = False
  | otherwise = ld n == n

issophie n | not (isprime n)     = False
           | isprime (2 * n + 1) = True
           | otherwise           = False

sophies = filter issophie [2..]

safeprimes = map (\x -> 2 * x + 1) sophies

Then something like

first100safes = take 100 safeprimes

the5thsafe = safeprimes!!5

Many safeprimes will take a bit (take 10000 safeprimes). You might want to capture them and keep them somewhere. With a little modification, you can start with a big sophie and work up. Maybe generate the next 10000 and add them to your list. Start things up and go get lunch.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.