Class SSOZJ5
java.lang.Object
de.tilman_neumann.jml.primes.exact.SSOZJ5
public class SSOZJ5
extends java.lang.Object
This Java source file is a multiple threaded implementation to perform an
extremely fast Segmented Sieve of Zakiya (SSoZ) to find Twin Primes <= N.
Inputs are single values N, of 64-bits, 0 -- 2^64 - 1.
Output is the number of twin primes <= N; the last
twin prime value for the range; and the total time of execution.
Run as Java application, and enter a range (comma or space separated) when asked in console.
(Accept scientific notation)
This java source file, and updates, will be available here:
gist.github.com/Pascal66
Example :
Please enter an range of integer (comma or space separated):
0 1e11
Logicals processors used = 12
Using Prime Generator parameters for given Pn 13
segment size = 524288 resgroups; seg array is [1 x 8192] 64-bits
twinprime candidates = 4945055940 ; resgroups = 3330004
each 1485 threads has nextp[2 x 27287] array
setup time = 0.015 secs
perform twinprimes ssoz sieve
1485 of 1485 threads done
sieve time = 4.538 secs
last segment = 184276 resgroups; segment slices = 7
total twins = 224376048; last twin = 99999999762+/-1
total time = 4.553 secs
Please enter an range of integer (comma or space separated):
0 1e12
Logicals processors used = 12
Using Prime Generator parameters for given Pn 13
segment size = 802816 resgroups; seg array is [1 x 12544] 64-bits
twinprime candidates = 49450550490 ; resgroups = 33300034
each 1485 threads has nextp[2 x 78492] array
setup time = 0.045 secs
perform twinprimes ssoz sieve
1485 of 1485 threads done
sieve time = 51.672 secs
last segment = 384578 resgroups; segment slices = 42
total twins = 1870585220; last twin = 999999999960+/-1
total time = 51.717 secs
The Jabari Zakiya code source files can be found here: gist.github.com/jzakiya
Mathematical and technical basis for implementation are explained here:
https://www.academia.edu/81206391/Twin_Primes_Segmented_Sieve_of_Zakiya_SSoZ_Explained
This code is provided free and subject to copyright and terms of the
GNU General Public License Version 3, GPLv3, or greater.
License copy/terms are here: gnu.org/licenses
Copyright (c) 2017-22 Jabari Zakiya -- jzakiya at gmail dot com
Java version 0.21.5 - Pascal Pechard -- pascal at priveyes dot net
Version Date: 2022/07/01
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSSOZJ5.Callback<T> -
Constructor Summary
Constructors Constructor Description SSOZJ5() -
Method Summary
Modifier and Type Method Description static java.math.BigIntegerBsqrt(java.math.BigInteger x)static java.lang.LongeModInv(long a, long m)Returns the modular inverse of 'a' mod 'm' if it exists.static longgcd(long a, long b)static voidmain(java.lang.String[] args)Only BigDecimal understand scientific notationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
SSOZJ5
public SSOZJ5()
-
-
Method Details
-
main
public static void main(java.lang.String[] args)Only BigDecimal understand scientific notation- Parameters:
args-
-
Bsqrt
public static java.math.BigInteger Bsqrt(java.math.BigInteger x) -
eModInv
public static java.lang.Long eModInv(long a, long m)Returns the modular inverse of 'a' mod 'm' if it exists. Make sure m > 0 and 'a' & 'm' are relatively prime. -
gcd
public static long gcd(long a, long b)
-