DEV Community

Roger Doss
Roger Doss

Posted on • Originally published at

Perl script to search for large primes

Experimental code to search for random probable primes for research.

The code will create multiple instances of the script which will search for a random prime starting with a random number. Note that each of the perl scripts run has its own threads. sleep calls are needed so as not to overheat the processor. The processes should end when one of the threads writes a file:

And this happens when one of the threads discovers a probable prime. At the same time, the discovered prime is written to the ./data directory.

The largest prime generated so far was 9800+ digits large.

You can control the size of the prime you are looking for by specifying the number of bits.

The code and data are here.

Top comments (0)