login
A176704
Number of twin primes between non-twin prime(n) and non-twin prime(n+1).
1
7, 2, 2, 0, 2, 2, 0, 0, 0, 4, 0, 0, 4, 0, 0, 0, 6, 0, 2, 2, 0, 0, 2, 2, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 2, 0, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 2, 0
OFFSET
1,1
LINKS
EXAMPLE
a(1)=7 because are 7 twin primes (3,5,7,11,13,17,19) between non-twin prime(1)=2 and non-twin prime(2)=23.
MAPLE
From R. J. Mathar, Apr 27 2010: (Start)
isA001097 := proc(n) isprime(n) and ( isprime(n+2) or isprime(n-2) ); end proc:
A001097 := proc(n) option remember; if n =1 then 3; else for a from procname(n-1)+2 by 2 do if isA001097(a) then return a; end if; end do: end if; end proc:
A007510 := proc(n) option remember; if n <= 2 then op(n, [2, 23]) ; else for a from procname(n-1)+2 by 2 do if isprime(a) and not isprime(a+2) and not isprime(a-2) then return a; end if; end do: end if; end proc:
A176704 := proc(n) local a, p ; a := 0 ; for p from A007510(n)+1 to A007510(n+1)-1 do if isA001097(p) then a := a+1 ; end if; end do: return a; end proc:
seq(A176704(n), n=1..120) ; (End)
MATHEMATICA
Which[#=={0}, Nothing, #[[1]]==1, Total[#], True, PadRight[{}, Length[ #]- 1, 0]]&/@Split[Table[If[AnyTrue[p+{2, -2}, PrimeQ], 1, 0], {p, Prime[ Range[ 300]]}]]//Flatten (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 13 2021 *)
CROSSREFS
Sequence in context: A108433 A274570 A334056 * A289917 A198415 A195723
KEYWORD
nonn
AUTHOR
EXTENSIONS
Corrected (a(21)=4 removed) by R. J. Mathar, Apr 27 2010
STATUS
approved