cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A278351 Least number that is the start of a prime-semiprime gap of size n.

This page as a plain text file.
%I A278351 #32 Sep 10 2018 15:34:01
%S A278351 2,7,26,97,341,241,6091,3173,2869,2521,16022,26603,114358,41779,74491,
%T A278351 39343,463161,104659,248407,517421,923722,506509,1930823,584213,
%U A278351 2560177,4036967,4570411,4552363,7879253,4417813,27841051,5167587,13683034,9725107,47735342,25045771,63305661
%N A278351 Least number that is the start of a prime-semiprime gap of size n.
%C A278351 A prime-semiprime gap of n is defined as the difference between p & q, p being either a prime, A000040, or a semiprime, A001358, and q being the next greater prime or semiprime, see examples.
%C A278351 The corresponding numbers at the end of the prime-semiprime gaps, i.e., a(n)+n, are in A278404.
%C A278351 In the first 52 terms, 19 are primes and the remaining 33 are semiprime. Of the end-of-gap terms a(n)+n, 20 are primes and 32 are not. There are only 6 pairs of p and q that are both primes, and 19 pairs that are both semiprime.
%H A278351 Dana Jacobsen, <a href="/A278351/b278351.txt">Table of n, a(n) for n = 1..106</a> (first 52 terms from Bobby Jacobs, Charles R Greathouse IV, Jonathan Vos Post and Robert G. Wilson v)
%e A278351 a(1) = 2 since there is a gap of 1 between 2 and 3, both of which are primes.
%e A278351 a(2) = 7 since there is a gap of 2 between 7 and 9, the first is a prime and the second is a semiprime.
%e A278351 a(3) = 26 since there is a gap of 3 between 26, a semiprime, and 29, a prime.
%e A278351 a(6) = 241 because the first prime-semiprime gap of size 6 is between 241 and 247.
%t A278351 nxtp[n_] := Block[{m = n + 1}, While[ PrimeOmega[m] > 2, m++]; m]; gp[_] = 0; p = 2; While[p < 1000000000, q = nxtp[p]; If[ gp[q - p] == 0, gp[q -p] = p; Print[{q -p, p}]]; p = q]; Array[gp, 40]
%o A278351 (Perl) use ntheory ":all";
%o A278351 my($final,$p,$nextn,@gp) = (40,2,1);  # first 40 values in order
%o A278351 forfactored {
%o A278351   if (scalar(@_) <= 2) { my $q = $_;
%o A278351     if (!defined $gp[$q-$p]) {
%o A278351       $gp[$q-$p] = $p;
%o A278351       while ($nextn <= $final && defined $gp[$nextn]) {
%o A278351         print "$nextn $gp[$nextn]\n";
%o A278351         $nextn++;
%o A278351       }
%o A278351       lastfor if $nextn > $final;
%o A278351     }
%o A278351     $p = $q;
%o A278351   }
%o A278351 } 3,10**14; # _Dana Jacobsen_, Sep 10 2018
%Y A278351 Cf. A000230, A037143, A131109, A275108, A275013, A275014, A278404.
%K A278351 nonn
%O A278351 1,1
%A A278351 _Bobby Jacobs_, _Charles R Greathouse IV_, _Jonathan Vos Post_, and _Robert G. Wilson v_, Nov 23 2016