In June (2019) I updated the Nim code to perform the SSoZ for Twin Primes. The new code (with release of Nim 0.20.0) produces the fastest known times, at least for inputs up to 10e14, as compared to Primesieve 7.4: [https://github.com/kimwalisch/primesieve](https://github.com/kimwalisch/primesieve)
Here's the code: twinprimes_ssoz,nim [https://gist.github.com/jzakiya/6c7e1868bd749a6b1add62e3e3b2341e](https://gist.github.com/jzakiya/6c7e1868bd749a6b1add62e3e3b2341e) Here's the paper that explains the algorithm. The Use of Prime Generators to Implement Fast Prime Sieves of Zakiya (SoZ), Applications to Number Theory, and implications for the Riemann Hypothesis [https://www.academia.edu/37952623/The_Use_of_Prime_Generators_to_Implement_Fast_Twin_Primes_Sieve_of_Zakiya_SoZ_Applications_to_Number_Theory_and_Implications_for_the_Riemann_Hypotheses](https://www.academia.edu/37952623/The_Use_of_Prime_Generators_to_Implement_Fast_Twin_Primes_Sieve_of_Zakiya_SoZ_Applications_to_Number_Theory_and_Implications_for_the_Riemann_Hypotheses) or [https://www.scribd.com/document/395415391/The-Use-of-Prime-Generators-to-Implement-Fast-Twin-Primes-Sieve-Of-Zakiya-SoZ-Applications-to-Number-Theory-and-Implications-for-the-Riemann-Hypoth](https://www.scribd.com/document/395415391/The-Use-of-Prime-Generators-to-Implement-Fast-Twin-Primes-Sieve-Of-Zakiya-SoZ-Applications-to-Number-Theory-and-Implications-for-the-Riemann-Hypoth) Here are timing comparisons to Primesieve on two (2) systems. 1) System 1 ➜ ~ inxi -SCM System: Host: localhost.localdomain Kernel: 5.1.11-pclos1 x86_64 bits: 64 Desktop: KDE Plasma 5.16.1 Distro: PCLinuxOS 2019 Machine: Type: Laptop System: System76 product: Gazelle v: gaze10 serial: <root required> Mobo: System76 model: Gazelle v: gaze10 serial: <root required> UEFI [Legacy]: American Megatrends v: 1.05.08 date: 03/31/2016 CPU: Topology: Quad Core model: Intel Core i7-6700HQ bits: 64 type: MT MCP L2 cache: 6144 KiB Speed: 1185 MHz min/max: 800/3500 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 Run N | twinprimes_ssoz | primesieve | Ratio | -------------------|-----------------|---------------|-------| 100_000_000_000 | 4.628 | 5.837 | 1.26 | 500_000_000_000 | 24.976 | 32.765 | 1.31 | 1_000_000_000_000 | 50.713 | 69.705 | 1.37 | 5_000_000_000_000 | 291.095 | 388.233 | 1.33 | 10_000_000_000_000 | 621.321 | 821.755 | 1.32 | 50_000_000_000_000 | 3028.456 | 4620.525 | 1.53 | 100_000_000_000_000 | 6307.521 | 9724.568 | 1.54 | 200_000_000_000_000 | 13603.531 | 20279.547 | 1.49 | Run 2) System 2 inxi -SCM System: Host: localhost Kernel: 5.1.9-pclos1 x86_64 bits: 64 Desktop: KDE Plasma 5.16.0 Distro: PCLinuxOS 2019 Machine: Type: Server System: Supermicro product: C7X99-OCE v: 0123456789 serial: <root required> Mobo: Supermicro model: C7X99-OCE v: 1.01 serial: <root required> UEFI [Legacy]: American Megatrends v: 1.0a date: 12/11/2014 CPU: Topology: 6-Core model: Intel Core i7-5820K bits: 64 type: MT MCP L2 cache: 15.0 MiB Speed: 2532 MHz min/max: 1200/3600 MHz Core speeds (MHz): 1: 1200 2: 1200 3: 1303 4: 1200 5: 1215 6: 1200 7: 1302 8: 1200 9: 1201 10: 1201 11: 1376 12: 1201 Run N | twinprimes_ssoz | primesieve | Ratio | ---------------------+-----------------+------------+--------- 100_000_000_000 | 3.403 | 5.335 | 1.57 | 500_000_000_000 | 18.019 | 29.918 | 1.66 | 1_000_000_000_000 | 39.680 | 62.239 | 1.57 | 5_000_000_000_000 | 235.462 | 346.909 | 1.47 | 10_000_000_000_000 | 512.071 | 730.726 | 1.43 | Run
