Some fast programs for generating prime numbers, calculating ============================================================ the number of twin primes and Bruns constant ============================================ Author ------ Stefan Spaennare, Lund, Sweden E-mail: stefan@spaennare.se Home page: http://www.spaennare.se/index.html Program page: http://www.spaennare.se/ssprog.html First version: 2005-06-06 Latest update: 2010-03-20 Contents -------- 1. Introduction 2. Important note 3. Compiling instructions 4. References 1. Introduction --------------- This readme file only covers how to compile the programs in the prime number package. See the header of each program source code (*.c) for information how to use the programs, algorithms, benchmarks etc. The package now comes with some pre-compiled executables with Intel icc C/C++ 11.1 compiler for 32-bit and 64-bit Linux. Purpose: esieve.c: Generating, counting and printing prime numbers. ptwins.c: Prime number and twin primes statistics. cbrun.c, cbrun2.c and cbrun3.c: Calculating prime number and twins primes statistics and Bruns constant (double precision version). cbrunl.c, cbrun2l32.c, cbrun3l32.c, cbrun2l64.c and cbrun3l64.c: Calculating prime number and twin primes statistics and Bruns constant (long double precision versions). Recommended versions for large n (>=10^10). 2. Important note ----------------- It is HIGHLY RECOMMENDED to run the programs cbrunl.c, cbrun2l32.c and cbrun3l32.c under Linux using GNU C/C++ compiler (gcc) or perhaps better Intel C/C++ compiler (icc) with long double precision (i.e. LDOUBLE 1 in the source code) for large n (>=10^10). Use the option "-pc80" with the Intel compiler. The GNU C/C++ compiler DJGPP (gcc) for DOS under Windows does not support long double precision for the functions sqrtl(), floorl(), fabsl() and logl() used by these programs. The author has commented out these functions in the source code of the programs (the Windows package only), with precision loss as result. 3. Compiling instructions ------------------------- The package now comes with some pre-compiled executables with Intel icc C/C++ 11.1 compiler for both 32-bit and 64-bit Linux. To compile all the programs (esieve.c, ptwins.c, cbrun.c, cbrun2.c, cbrun3.c, cbrunl.c, cbrun2l32.c, cbrun3l32.c, cbrun2l64.c and cbrun3l64.c) using GNU gcc run the script (in the GCCSRC directory): >chmod +x compall-gcc >compall-gcc To compile the programs cbrun2l32.c, cbrun3l32.c, cbrun2l64.c and cbrun3l64.c using Intel icc (with the "-pc80" option, i.e. 80-bit floating point operands) use the script (in the ICC32EXE or ICC64EXE directories): >chmod +x compall-icc32 >compall-icc32 >chmod +x compall-icc64 >compall-icc64 The "-p3" versions are for Intel Pentium III, "-p4" for Pentium 4 and "-c2d" Core 2 Duo/Quad processors. The "-p4" and perhaps also the "-c2d" versions should work fine also on newer AMD processors. Note, both the Intel compiler (icc) and GNU gcc have many optimization options to play with. Try to find the best ones for your computer. Type "icc -help" or see the manual pages for gcc for more information. Note, the 64-bit versions (cbrun2l64.c and cbrun3l64.c are much slower than the 32-bit versions on 32-bit computers but comparable in speed with the 32-bit versions on 64-bit machines. References ---------- 1. The Intel C/C++ 11.1 (icc) compiler (or later versions in the future) can be downloaded for free (for Linux, about 600 Mbyte) from: http://www.intel.com 2. The GNU DJGPP C/C++ (gcc) compiler for DOS under Windows 98/2000/XP can be downloaded for free from: http://www.delorie.com/djgpp/ ------------------------- End of readme_p.txt file.