20190521, 00:26  #78 
Apr 2010
Over the rainbow
3^{3}·89 Posts 
ok, here are my numbers
bat/perl with 2 core Code:
Start Time: 2:20:59,69 Finish Time: 2:22:46,67 The new script (which doesn't write a file yet) on a single core Code:
elapsed time = 01:02:17.972027 So it seems thatthe new perl script is about 4 time quicker. 
20190521, 14:33  #79  
Feb 2003
3·5·127 Posts 
Quote:
There are actually two different functions with the same name "sieve_prime_cluster". One is defined in Math::Prime::Utils, and another (slower) one is defined in Math::Prime::Utils::GMP. While on Linux it correctly uses the faster one from Math::Prime::Utils, on Windows it seems to fall back to the slower one from Math::Prime::Utils::GMP, even if this package isn't explicitly used by the script. You can test this on your machine(s) by changing the line Code:
use Math::Prime::Util qw/:all/; Code:
use Math::Prime::Util::GMP qw/:all/; On Linux I get 3 secs vs. 65 secs, while on Windows I'm getting 65 secs in both cases. (All for just one 2e8 iteration.) 

20190521, 17:43  #80 
Apr 2010
Over the rainbow
3^{3}·89 Posts 
ok, so apparently I have the slow verion on windows. any way to specify the faster module?

20190522, 08:58  #81 
Feb 2003
3·5·127 Posts 
Here are some further timings for the two versions of sieve_prime_cluster, all for one iteration (interval = 2e8):
Code:
$from "GMP" "nonGMP"  0 112.4 sec 3.3 sec 3.7e6 109.8 sec 3.1 sec 3.7e10 36.8 sec 2.2 sec 3.7e14 12.4 sec 2.5 sec 3.7e15 10.5 sec 3.0 sec 
20190523, 13:26  #82 
Feb 2003
11101110001_{2} Posts 
Meanwhile I finished the interval [8.5e14;9.0e14].
Code:
3016 860568785161207 3104 850373961384458 3111 854246643055437 ... 3940 874799018995998 3968 889713596180965 4065 862629306774760 Please let me know from where I should continue (9.5e14 or 1e15)...? 
20190523, 14:58  #83  
Jun 2003
Oxford, UK
3·5^{4} Posts 
Quote:
Out of interest one of the two perl suites has a twin_prime function that may be quicker. Has anyone tried? 

20190523, 17:43  #84 
Apr 2010
Over the rainbow
100101100011_{2} Posts 
Meanwhile, I have done about 25% of my workload, from 9e15 to 9.01e15
I'm sure many gap I found are the same as Thomas one. His are better than mine, probably. Found 325 gap Code:
3016 9000070942331767 3104 9001387635261233 3111 9001088083731142 ... 4226 9002250610190467 4443 9009758172001925 4905 9000382149988845 Last fiddled with by firejuggler on 20190523 at 17:46 
20190524, 09:06  #85  
Feb 2003
3·5·127 Posts 
Quote:
Your suggestion of using the "twin_primes" function was a really a good idea, Robert! I already tested it before, and found a similar performance to the use of "sieve_prime_cluster". That was on my Linux system... Now, I've tested it again on Windows and getting the same speed as on Linux (about 10 secs per 1e9 interval). So, the performance drop is gone! I modified Robert's perl script as follows: It uses a subinterval of 1e9 now, which seems to be optimal. And I eliminated the need for the overlap between subintervals by keeping the last twin of each interval. The "overlap" is still used once in order to obtain the last twin preceding the search interval. BTW: Robert, note the use of "use integer" which solves your earlier printing problem with numbers greater than 1e15. Code:
#!/usr/bin/env perl use warnings; use strict; use Math::Prime::Util qw/:all/; use v5.10; use Time::HiRes qw(gettimeofday time tv_interval); $=1; my $interval = 1_000_000_000; my $overlap = 100_000; my $from = shift  1_000_000_000_000_000; my $numberofiterations = shift  1; my $reportsmallgapmult = shift  2000; my $t0 = [gettimeofday]; # find the largest twin prime below search interval my @twins = @{twin_primes(6*$from6*$overlap, 6*$from)}; my $lasttwin = $twins[$#twins]; for (my $k=0; $k < $numberofiterations; $k++) { my $start = 6*($from+$k*$interval); my $end = $start+$interval*6; my @twins = @{twin_primes($start, $end)}; my $gap = ($twins[0]$lasttwin); if ($gap>=$reportsmallgapmult*6) { use integer; say $gap/6, " ", ($lasttwin+1)/6; } for (my $l=1; $l < scalar @twins; $l++) { my $gap = ($twins[$l]$twins[$l1]); if ($gap>=$reportsmallgapmult*6) { use integer; my $firsttwin = ($twins[$l1]+1)/6; say $gap/6, " ", $firsttwin; } } $lasttwin = $twins[$#twins]; } my $duration = tv_interval($t0); printf ("\nExecution time: %.2fs\n", $duration); 

20190524, 14:51  #86 
Jun 2003
Oxford, UK
3·5^{4} Posts 
I can't wait to use the new program when I get back next week. Any chance someone can make this multithread?

20190524, 19:14  #87 
Feb 2003
3·5·127 Posts 

20190525, 06:51  #88 
Jun 2003
Oxford, UK
3×5^{4} Posts 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Gaps between maximal prime gaps  Bobby Jacobs  Prime Gap Searches  52  20200822 15:20 
I found a sieve to search all pairs of twin primes  Pietro Maiorana  Twin Prime Search  8  20190926 23:07 
find very easy twin prime in the infamy twin primes  hal1se  Miscellaneous Math  13  20181105 16:34 
Mersenne Primes p which are in a set of twin primes is finite?  carpetpool  Miscellaneous Math  3  20170810 13:47 
Gaps of Primes?  PawnProver44  Miscellaneous Math  10  20160410 19:32 