OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
MAPLE
f:= proc(n) local p, d;
p:= ithprime(n); d:= ilog2(n);
numtheory:-pi(p+d)-numtheory:-pi(p-d-1)
end proc:
map(f, [$1..200]); # Robert Israel, Aug 13 2018
MATHEMATICA
a[n_] := With[{p = Prime[n], d = BitLength[n]-1}, PrimePi[p+d] - PrimePi[p-d-1]];
Table[a[n], {n, 1, 200}] (* Jean-François Alcover, Feb 07 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Sep 06 2004
STATUS
approved