A089637 Smallest member of a pair of consecutive twin prime pairs that have exactly n primes between them.
3, 17, 41, 107, 71, 2267, 1091, 461, 1319, 1151, 347, 5741, 2999, 5279, 10139, 1487, 9461, 881, 659, 13007, 9041, 15359, 8627, 28751, 83717, 13397, 18539, 14627, 44771, 54011, 60257, 59669, 142157, 77711, 61559, 178931, 26261, 122867, 293261, 89069, 24419, 167861
Offset: 0
Keywords
Examples
a(0) = 3 since there is no prime between the twin primes (3, 5) and (5, 7). - _David A. Corneth_, Dec 27 2019 a(1) = 17 since there is one prime, 23, between the twin primes (17, 19) and (29, 31). a(2) = 41 since there are 2 primes, 47 and 53, between the twin primes (41, 43) and (59, 61).
Links
- David A. Corneth, Table of n, a(n) for n = 0..342 (terms n = 1..226 from and terms > 10^12 from Amiram Eldar)
- David A. Corneth and Amiram Eldar, Terms <= 1.5*10^12 (0 indicates the term is > 1.5*10^12) (terms > 10^12 from Amiram Eldar)
Programs
-
Maple
A181981 := proc(n) local j,hi,lo ; if n = 0 then 3; else for j from 1 do hi := numtheory[pi](A001359(j+1)) ; lo := numtheory[pi](A006512(j)) ; if hi-lo = n+1 then return A001359(j); end if; end do: end if; end proc: # R. J. Mathar, Jul 03 2012
-
Mathematica
countPrimes[pin_] := Module[{prv = pin, c = 0, p}, p = NextPrime[prv]; While[p != prv + 2, c++; prv = p; p = NextPrime[p]]; {c-1, p}]; p = 13; mx = 20; c = 0; seq = Table[0, {mx}]; While[c < mx, cp = countPrimes[p]; i = cp[[1]]; If[i > 0 && i <= mx && seq[[i]] == 0, c++; seq[[i]] = p - 2]; p = cp[[2]]]; seq (* Amiram Eldar, Dec 26 2019 *)
-
PARI
pbetweentw(n) = /* p is the number of primes between */ { for(p=0, 100, forstep(x1=1, n, 1, my(c=0, t1 = twin[x1], t2 = twin[x1+1]); for(y=t1+4, t2-1, if(isprime(y), c++) ); if(c==p, print1(t1", "); break) ) ) } savetwins(n) = /* Build a twin prime table of lower bounds */ { twin = vector(n); my(c=1); forprime(x=3, n*10, if(isprime(x+2), twin[c]=x; c++; ) ) }
Extensions
Offset corrected and data corrected and expanded by Amiram Eldar, Dec 26 2019
a(0) = 3 prepended by David A. Corneth, Dec 27 2019
Comments