OFFSET
2,2
FORMULA
EXAMPLE
The 10th prime - the 9th prime = 29-23 = 6. The integer between 23 and 29 that is divisible by 6 is 24. 24 is the 14th composite, so a(9) = 14.
MAPLE
A113709 := proc(n) local d, a ; d := ithprime(n+1)-ithprime(n) ; for a from ithprime(n)+1 do if a mod d = 0 then RETURN(a) ; fi ; od: end: A066246 := proc(n) local a, i; if n = 1 or isprime(n) then 0 ; else a := 0 ; for i from 4 to n do if not isprime(i) then a := a+1 ; fi ; od: RETURN(a) ; fi ; end: A133555 := proc(n) A066246(A113709(n)) ; end: seq(A133555(n), n=2..80) ; # R. J. Mathar, Jan 12 2008
MATHEMATICA
compositePi[n_] := n - PrimePi[n] - 1;
a[n_] := Module[{p1 = Prime[n], p2 = Prime[n+1], c}, c = SelectFirst[ Range[p1+1, p2-1], Divisible[#, p2-p1]&]; compositePi[c]];
Table[a[n], {n, 2, 62}] (* Jean-François Alcover, Apr 02 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Dec 25 2007
EXTENSIONS
More terms from R. J. Mathar, Jan 12 2008
STATUS
approved