OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(4)= 8 because between the 4th and 5th pairs of twins (17,19) and (29,31), there are 8 composites: 20, 21, 22, 24, 25, 26, 27, 28.
MAPLE
T:=array(1..200, 1..2):k:=0:for n from 1 to 1000 do:p1:=ithprime(n):p2:=ithprime(n+1):if p2-p1 = 2 then k:=k+1:T[k, 1]:=p1:T[k, 2]:=p2:else fi:od: for p from 1 to k do:i:= T[p, 2]+1: j:= T[p+1, 1]-1 :ii:=0:for q from i to j do:if type(q, prime)=false then ii:=ii+1:else fi:od: printf(`%d, `, ii):od:
MATHEMATICA
nc[{a_, b_}]:=Count[Range[a+3, b-1], _?(!PrimeQ[#]&)]; With[{tp=Partition[ Transpose[ Select[Partition[Prime[Range[ 500]], 2, 1], Last[#]-First[#] == 2&]][[1]], 2, 1]}, nc/@tp] (* Harvey P. Dale, Jun 25 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jan 11 2012
STATUS
approved