Version 1.2
Description Fast calculation of prime numbers up to 4000000000
Environments Win32 / OS/2 / Linux command line
Compiler Windows: MS Visual C++ 6.0
OS/2: emx/gcc 3.2.1 / Open Watcom C++ 1.3 / IBM Visual Age C++ 3.0 / Borland C++ 2.0
Linux: gcc 3.3.3
Porting Porting should be easy.
The speed depends on the compiler used.
How to use ?
  1. primf[w|2|x] MAX  [FILE
  2. calculates the prime numbers until MAX and writes them to FILE.
  3. primf[w|2|x] -pCOLUMS MIN MAX  [FILE]
  4. reads FILE and prints the prime numbers from MIN  to MAX.
How does it work ? Primf uses an optimized sieve of Eratosthenes.
The file contains 1 bit per odd number (i.e. 1 byte for 16 numbers).
How to build ? call mk
How to install ? no installation needed, just copy the files
Author Frank Reglin
License General Public License
Documentation calling primf[w|2|x] without arguments prints a short one.
Older versions
Ideas for further development
  • make it faster
    Hint: The fastest algotithm may depend on the CPU, e.g. 1.2 is faster as 1.0 on Pentium 4 but slower on Pentium.
  • allow bigger numbers