mersenneforum.org Prime Generators and/or Source Codes
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

 2004-05-21, 05:30 #1 Erasmus   Feb 2004 23 Posts Prime Generators and/or Source Codes Hi Me and my colleague need a prime generator for our next text project. We'll be working on some of RSA's recent assignments and measure the performance of some methods. To do it, we must use a source code or executable to generate a prime list in a text file, or if possible in real time. If the program can generate especially n-digit primes, it will be much better. Or it can at least be configured as "generate next n primes after the threshold" Do you suggest any link for this purpose. I will be glad to hear from you. Thanks for your help Emrecan
 2004-05-21, 05:41 #2 jinydu     Dec 2003 Hopefully Near M48 175810 Posts
 2004-05-21, 12:55 #3 alpertron     Aug 2002 Buenos Aires, Argentina 23×132 Posts The previous link is useful only when you need primes of up to 14 digits, so it does not work for 500-1000 bit primes, as needed in RSA. You can use my factorization applet at: http://www.alpertron.com.ar/ECM.HTM . It allows formulas to be entered. The functions useful for you are b(x) (previous strong pseudoprime) and n(x) (next strong pseudoprime). For instance, if you enter n(2^511), it will find the first 512-bit pseudoprime, and then it will apply the APR-CLE algorithm that shows that the 155-digit number in screen is prime. The entire process needs 34 seconds in my Pentium 4. Last fiddled with by alpertron on 2004-05-21 at 12:59 Reason: Changed 2^512 by 2^511
2004-05-21, 13:55   #4
akruppa

"Nancy"
Aug 2002
Alexandria

2,467 Posts

You could use the mpz_nextprime() function found in GMP. From the info page:

Quote:
 - Function: void mpz_nextprime (mpz_t ROP, mpz_t OP) Set ROP to the next prime greater than OP. This function uses a probabilistic algorithm to identify primes. For practical purposes it's adequate, the chance of a composite passing will be extremely small.

Alex

 Similar Threads Thread Thread Starter Forum Replies Last Post bhelmes Computer Science & Computational Number Theory 122 2017-08-25 21:09 Antonio Information & Answers 6 2011-09-27 13:20 science_man_88 Programming 13 2011-06-24 06:52 dave_0273 Data 1 2004-05-02 15:08 GP2 Data 14 2003-12-28 22:02

All times are UTC. The time now is 04:44.

Fri May 7 04:44:16 UTC 2021 up 28 days, 23:25, 0 users, load averages: 2.03, 1.83, 1.84