Prime Searching Software

The software on this page is free to the general public for usage in their prime number searches. Each user must understand that they use this software at their own risk. If PRP, Proth, or Prime95 make your computer run too hot, so will this software. The only guarantee I can provide is that I personally use this software in my prime searches.

TwinGenX.exe - Version 2.2.5, May 29, 2012 - Version 2.2.5, May 29, 2012 - Build 205, May 29, 2012
TwinGen.exe - Build 209, October 28, 2002 - February 2003 - You know what this is.

PrMerge has not changed in the last 2 years.  It is included for completeness.

JohnData.dat is a special data file for John.

TwinGen Version 2.2.5

Version 2.2.5 includes a number of performance enhancements as well as the completion of the fast array mode processing for traditional non-multiple math modes.  This version only deals with odd K values.  The even K values are not stored or processed.  There are 3 basic running modes:

Start new sieve - This is the basic sieve starting mode and always uses a bitmap representation.  The Stop P value and auto increment work together to sieve up to a given P value, store the results, and then continue after incrementing the n value by one.  The n Min and n Max values should be the same number when using this option.  When using auto increment, the output file name has 'nnnnn.txt' appended to it for every n value process.  There is a different output file for each n value.  This allows interruption and the ability to resume at a given n value.

Resume old sieve - The default resume is fast array mode.  To continue in bitmap mode, uncheck the Fast Array Mode option.

Combine sieve results - This combines the two input files by taking the lowest P value and performing a union.  Any value in either file is selected.  This is most useful when sieving a very wide range with auto increment turned on.  After a set of files is created, they can be merged into a single file that can be resumed in fast array mode.

For maximum performance the number of calc threads should be set to the number of cores in a processor with 4 or less cores.  If the processor has more than 4 cores and k Max < p Max, then set to number calc threads to the number of cores-1.  Example, on an Phenom II (1090T),  with 5 calc threads the sieve can run a double sieve (twin, CC1, CC2) with a p rate of 685,000,000 per second.  Results vary depending upon cache utilization and other processes running.

If you are running a major project, contact the author for best usage in your situation.

Build 112f

Build 112f - Additional speed improvements, support for higher densities with multiple 'or' conditions like Twin/SG or CC1 or Twin/SG-.  Find base prime and at least 2 of the other 3 candidates (twin, n+1, n-1) have been sieved.  Also could test CC2 as a separate triple sieve output.  Contact the author to see if any features fit your specific application.

TwinGenX is a 64 bit Windows sieve tuned and optimized for searching for prime candidates of the form k*2n+/-1.  This initial release is designed to demonstrate the speed and benefits of the new features, which include:

Multiple Concurrent Math Modes:   Calculates all the basic types concurrently.  See supported sieve types.  This is used for multiple density multiple sieves and specialized searches.
Multiple N Ranges: Useful for selecting a range of K values where LLR is more efficient.
Multiple CPU Core: Utilize multiple CPU cores to speed up the sieve.  This is more efficient that running multiple copies of a sieve over different P ranges and then merging the results.
No Bitmap Size Limit: Bitmaps are only limited to physical RAM size.  This reduces the number of times sieving various K ranges and merging results.

Supported Concurrent Sieve Types

Single:Minus k.2^n-1;   Plus k.2^n+1
Double:Twin k.2^ną1;   SG k.2^n-1 and k.2^(n+1)-1;   CC k.2^n+1 and k.2^(n+1)+1
Triple: Twin/SG k.2^ną1 and k.2^(n+1)-1;   Twin/CC k.2^ną1;   CC1 k.2^(n, ną1)-1;   CC2 k.2^(n, ną1)+1
Quad: LM k.2^ną1 and k.2^(ną1)-1;   LP k.2^ną1 and k.2^(ną1)+1
Multi-Density Double:    Twin or SG;   Twin or CC.   See discussion below
Multi-Density Triple: Twin/SG or CC1;   Twin/CC or CC2;  Twin/SG-LM;  Twin/CC-LP.   See discussion below.

Multi-Math Notes

In multi-math mode, three files are saved, name.txt, name.txt.MinusRef, and name.txt.PlusRef.  These contain all the information on the sieve results.  These are saved at every checkpoint (after a certain amount of time) and when the program is stopped.  To get files of the desired sieve types, check the desired file types on the options dialog.  To get a new output type, stop the sieve, check the new output type, resume the sieve.  The new type will be saved when the sieve next stops.

Multi-math has a drawback in memory usage.  For a single N value, it saves two N-1 bitmaps, two N bitmaps, and two N+1 bitmaps (all in the three save files).  This means only 33% of the memory is effectively utilized.  To offset this issue, set a N range of 4-6.  An N range of 6 saves 16 (6*2 + 4) bitmaps and utilizes 12, resulting in 75% memory efficiency. 

Specialized / Significant Pair Searches / Details

Multiple Sieves

When searching for a significant pair, one big speed advantage is to use a quad (or at least a triple) sieve.  Example, sieve using a LM sieve and test k*2n-1.   If it is a prime, then test 3 more possibilities (Twin, SG with n+1, SG with n-1).  The drawback is that the number of LM candidates found is a sieve is very small and requires a very wide sieve that may result in slower LLR performance.  A reasonable compromise is use a triple sieve.  Test one number, and if prime, have two possibilities at a significant pair.

While the number of candidates of a triple sieve is much better, there still are limitations.  The density of the triple sieve (number of candidates) can be increased nearly 3 times using techniques such as the following example.  Save 3 sieve outputs, Twin/SG with LM removed, CC1 length 3, and CC2 length 3.  This produces 3 independent triple sieve candidate sets with a total of nearly 3 times the candidates.  Test the common number in each set.  Example, test the k*2n-1 candidate from the CC1 set.  If prime, test the k*2n-1-1 and k*2n+1-1 candidates.

Multiple N Ranges

One strategy for maximizing the speed of LLR is to sieve multiple N ranges and limit the K range to where LLR is most efficient.  This feature provides that capability.  For small N ranges, this is a good concept.  For very large N ranges the sieve will be significantly slower and the actual benefit in LLR speed needs to be factored into the decision process.

Multiple Sieve and Multiple N Ranges

It is possible to get the best efficiency of significant pairs by using multiple density multiple sieves with multiple N ranges.  The decision criteria and discussion is more than can be easily typed into an introductory web page.  Contact the author if you want that type of discussion.

David Underbakke - David9 At


Highly optimized software is normally not created in isolation. I want to thank Yves Gallot, David Broadhurst, and Paul Jobling for their input, suggestions, and assistance.