OFFSET
1,1
COMMENTS
Conjecture: a(n) > 0 for all n.
MAPLE
with(numtheory):
a:= proc(n) option remember; local k, p, q, r, pn;
pn:= ithprime(n);
for k from `if`(n=1, 1, pi(a(n-1))) do
p:= ithprime(k);
q:= ithprime(k+1);
r:= ithprime(k+2);
if denom((q-p)/(r-q)) = pn then break fi
od; q
end:
seq(a(n), n=1..10); # Alois P. Heinz, Jan 06 2011
MATHEMATICA
a[n_] := a[n] = Module[{k, p, q, r, pn},
pn = Prime[n];
For[k = If[n == 1, 1, PrimePi[a[n - 1]]], True, k++,
p = Prime[k];
q = Prime[k + 1];
r = Prime[k + 2];
If [Denominator[(q - p)/(r - q)] == pn, Break[]]]; q];
Table[a[n], {n, 1, 10}] (* Jean-François Alcover, Mar 18 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Jan 06 2011
EXTENSIONS
More terms from Alois P. Heinz, Jan 06 2011
STATUS
approved