20190308, 08:57  #12 
Jun 2003
11·421 Posts 

20190308, 09:49  #13  
Jun 2003
Oxford, UK
3·5^{4} Posts 
Quote:
One remark: there does not appear to be a much of a race between 1mod3 gaps and 2mod3 gaps  you don't get that with the primes, where there are notable races at varying x in pmodx. A quick run for primes from 2 to 9973 shows that that there are only three possible position in the gapmod3 race: cumulatively 1mod3 one ahead of 2mod3  occurs only once, all prime gaps up to p=3 cumulatively 1mod3 equal to 2mod3  occurs 50% of the time cumulatively 1 mod3 one behind 2mod3  occurs 50% of the time. This demonstrates Dr S's comments on permissible gaps patterns mod3 Table shows A = tested integer range from 2 to 10^A B = cumulative total of gaps that are 0mod3 C = cumulative total of gaps that are 1mod3 D = cumulative total of gaps that are 2mod3 E = cumulative gap total F = ratio of 0mod3 gaps to total gaps Code:
A B C D E F 10 0 2 2 4 0 100 7 9 9 25 0.28 1000 53 57 58 168 0.31547619 10000 471 379 379 1229 0.383238405 100000 3853 2869 2870 9592 0.401688907 1000000 32821 22838 22839 78498 0.418112563 10000000 286009 189285 189285 664579 0.430361176 100000000 2528513 1616471 1616471 5761455 0.438867092 1000000000 22633034 14107250 14107250 50847534 0.445115667 10000000000 204759775 125146368 125146368 455052511 0.449969553 Here is a simple graph showing the 0.5 tendency Last fiddled with by robert44444uk on 20190308 at 10:09 

20190308, 10:11  #14 
Jun 2003
Oxford, UK
3·5^{4} Posts 
Here's a perl program  not very efficient, but does not fall over:
Code:
#!/usr/bin/env perl use warnings; use strict; use Math::Prime::Util qw/:all/; use Math::Prime::Util::GMP; use v5.10; use Data::Dump qw(dump); use File::Slurp; use List::Util qw( min max ); use List::MoreUtils ':all'; $=1; my $start = 400_000_000_000; my $end = 600_000_000_000; for (my $k=$start; $k <=$end; $k+=1_000_000_000) { my $l = $k+1_000_000_000; say "starting range from: ", $k," to : ",$l; forprimes { my $x = (($_+next_prime($_))/2); if (next_prime($x)%1e8 < $x%1e8) {say "done to ",$x;} my $oneminus = prev_prime($x); my $oneplus = next_prime($x); if ($x$oneminus == $oneplus$x) { my $twominus = prev_prime($oneminus); my $twoplus = next_prime($oneplus); if ($x$twominus == $twoplus$x) { my $threeminus = prev_prime($twominus); my $threeplus = next_prime($twoplus); if ($x$threeminus == $threeplus$x) { my $fourminus = prev_prime($threeminus); my $fourplus = next_prime($threeplus); if ($x$fourminus == $fourplus$x) { my $fiveminus = prev_prime($fourminus); my $fiveplus = next_prime($fourplus); if ($x$fiveminus == $fiveplus$x) { my $sixminus = prev_prime($fiveminus); my $sixplus = next_prime($fiveplus); if ($x$sixminus == $sixplus$x) { my @factored = factor ($x); #say $x,"=factors as: ", dump @factored; #say "6 ",$x," ",$sixminus," ", $fiveminus," ",$fourminus," ", $threeminus," ", $twominus," ",$oneminus," ",$oneplus," ", $twoplus," ",$threeplus," ",$fourplus," ",$fiveplus," ",$sixplus; my $sevenminus = prev_prime($sixminus); my $sevenplus = next_prime($sixplus); if ($x$sevenminus == $sevenplus$x) { say "7 ",$x," ",$sevenminus," ", $sixminus," ", $fiveminus," ",$fourminus," ", $threeminus," ", $twominus," ",$oneminus," ",$oneplus," ", $twoplus," ",$threeplus," ",$fourplus," ",$fiveplus," ",$sixplus," ",$sevenplus; my $eightminus = prev_prime($sevenminus); my $eightplus = next_prime($sevenplus); if ($x$eightminus == $eightplus$x) { say "8 ",$x," ",$eightminus," ",$sevenminus," ", $sixminus," ", $fiveminus," ",$fourminus," ", $threeminus," ", $twominus," ",$oneminus," ",$oneplus," ", $twoplus," ",$threeplus," ",$fourplus," ",$fiveplus," ",$sixplus," ",$sevenplus," ",$eightplus; my $nineminus = prev_prime($eightminus); my $nineplus = next_prime($eightplus); if ($x$nineminus == $nineplus$x) { say "9 ",$x," ",$nineminus," ", $eightminus," ",$sevenminus," ", $sixminus," ", $fiveminus," ",$fourminus," ", $threeminus," ", $twominus," ",$oneminus," ",$oneplus," ", $twoplus," ",$threeplus," ",$fourplus," ",$fiveplus," ",$sixplus," ",$sevenplus," ",$eightplus," ",$nineplus; my $tenminus = prev_prime($nineminus); my $tenplus = next_prime($nineplus); if ($x$tenminus == $tenplus$x) { say "10 ",$x," ",$tenminus," ",$nineminus," ", $eightminus," ",$sevenminus," ", $sixminus," ", $fiveminus," ",$fourminus," ", $threeminus," ", $twominus," ",$oneminus," ",$oneplus," ", $twoplus," ",$threeplus," ",$fourplus," ",$fiveplus," ",$sixplus," ",$sevenplus," ",$eightplus," ",$nineplus," ",$tenplus; my $elevenminus = prev_prime($tenminus); my $elevenplus = next_prime($tenplus); if ($x$elevenminus == $elevenplus$x) { say "11 ",$x," ",$elevenminus," ", $tenminus," ",$nineminus," ", $eightminus," ",$sevenminus," ", $sixminus," ", $fiveminus," ",$fourminus," ", $threeminus," ", $twominus," ",$oneminus," ",$oneplus," ", $twoplus," ",$threeplus," ",$fourplus," ",$fiveplus," ",$sixplus," ",$sevenplus," ",$eightplus," ",$nineplus," ",$tenplus," ",$elevenplus; }}}}}}}}}}} } $k,$l; say "completed range from ", $k, " to ", $l; } 
20190308, 11:28  #15 
Jun 2003
1217_{16} Posts 

20190308, 12:55  #16  
Jun 2003
Oxford, UK
11101010011_{2} Posts 
Quote:
I have no doubt this could be speeded up a lot with some canny programming and short cuts 

20190308, 18:08  #17 
Dec 2008
you know...around...
3^{2}×61 Posts 
I've found a 10interprime during a 20hoursearch on my PC at work:
1,797,595,814,863 1,797,595,814,873 1,797,595,814,897 1,797,595,814,921 1,797,595,814,939 1,797,595,814,941 1,797,595,814,951 1,797,595,814,977 1,797,595,815,011 1,797,595,815,013 1,797,595,815,017 1,797,595,815,019 1,797,595,815,053 1,797,595,815,079 1,797,595,815,089 1,797,595,815,091 1,797,595,815,109 1,797,595,815,133 1,797,595,815,157 1,797,595,815,167 interprime = 1,797,595,815,015 = 3 * 2,347,451 * 17# / 2 The task inspired me to speed up my own VBA program a bit, so now I can search about 110e9 per hour (i5 @ 3 GHz; if you want to, I can post the code), which isn't quite state of the art, but I'm a bit relieved today after I read yesterday that you searched to "1.5e13", but apparently you changed that. Maybe I'll continue the search next week. 
20190308, 22:13  #18 
"Dana Jacobsen"
Feb 2011
Bangkok, TH
2·11·41 Posts 
Some simple transforms of Robert's code give a ~2x speedup, or about 22e9/hour on a singlethread Macbook.
But then perhaps we notice that oneminus and oneplus are just the last and current prime which we already have, so we can remove those calls entirely along with the other prev/next calls before them. Still at only 34e9/hour though. It looks like the whole thing can just be run using some lag and a small array, so no need for any of the prev/next calls. As an experiment, I modified forprimes to only return for 3interprimes. The rest of the code I left alone since the number of actual calls is a much more reasonable number. It runs at 4300e9/hour now. This is just a hack of the C code. Looks like adding one more level (4interprimes) gets to about 5000e9/hour. It found the first 9interprime in a little under 1 second. The 10 interprime took about 29 minutes. Using this method, the fastest would probably be some C code using primesieve. Pari/GP would probably do a decent job also. Perl/ntheory is going to suffer just because of how slow Perl is  I'm avoiding that by using the C code directly for the first part, so it's probably not much slower than primesieve until up in the 1e14 range at least. 
20190308, 23:12  #19 
Jun 2003
Oxford, UK
3×5^{4} Posts 
I'm travelling again. But really ...astonishing!! chaps

20190309, 08:24  #21 
Jun 2003
Oxford, UK
1875_{10} Posts 
Well I'm not totally surprised that we are not the first. But I'm disappointed that I did not spot these two lists.

20190311, 14:21  #22  
May 2018
5×37 Posts 
Quote:
Last fiddled with by Bobby Jacobs on 20190311 at 14:24 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Primorials squared primes?  siegert81  Math  6  20101228 15:17 
The factorization of primorials +/ 1  Joppe_Bos  Factoring  67  20080129 13:51 
Factors of primorials  grandpascorpion  Math  9  20050210 07:13 