Pascal66 / TwinsPrimesSieve

Twinprimes generator, multi-threaded, using SSoZ (Segmented Sieve of Zakiya), written in Java
GNU General Public License v3.0
2 stars 0 forks source link

False twin primes are reported #1

Open xecej4 opened 2 years ago

xecej4 commented 2 years ago

Nice program, runs fast and being able to run with a specified range, with a lower limit other than 1, is nice.

However, both versions SSOZJ and SSOZJ3B report many false twin primes, the latter very frequently and even small pairs such as (47, 49):

Command: echo 1 49 | java sieve.SSOZJ3B | grep twins

Output: total twins = 7; last twin = 48+/-1

Similarly, for SSOZJ:

`T:\PRIMES>echo 16850981 16851031 | java sieve.SSOZJ | grep twins total twins = 1; last twin = 16850988+/-1

T:\PRIMES>echo 16850981 16851021 | java sieve.SSOZJ | grep twins total twins = 0; last twin = 0+/-1

T:\PRIMES>factor 16850987 16850987: 16850987

T:\PRIMES>factor 16850989 16850989: 4099 4111`

It is curious that narrowing the range from (16850981, 16851031) to (16850981, 16851021) causes the incorrectly reported twin primes to disappear!

Thank you. I am not a Java programmer, but I found your program useful, and wanted to make you aware of the bug.

Pascal66 commented 2 years ago

Hello ! Thank you for reporting the bug. I've made an updated version

src/fr/cridp/sieve/SSOZJ5.java

Feel free to report any bug on this one