OFFSET
1,2
LINKS
Altug Alkan, Table of n, a(n) for n = 1..10000
Altug Alkan, Alternative scatterplot of A284397
Altug Alkan, Scatterplot of 4*a(n)-n
FORMULA
a(1) = 1, a(2) = 2; a(n) = A007917(a(a(n-1)) + a(n-a(n-2)-1)) for n > 2.
EXAMPLE
a(6) = 5 because a(a(5)) + a(6 - a(4) - 1) = a(3) + a(2) = 3 + 2 = 5 and A007917(5) = 5.
MATHEMATICA
a[n_]:= If[n<3, n, Prime@ PrimePi[a[a[n - 1]] + a[n - a[n - 2] - 1]]]; Table[a[n], {n, 1, 50}] (* Indranil Ghosh, Mar 26 2017 *)
PROG
(PARI) a=vector(1000); a[1]=1; a[2]=2; for(n=3, #a, a[n] = precprime(a[a[n-1]]+a[n-a[n-2]-1])); a
CROSSREFS
KEYWORD
nonn
AUTHOR
Altug Alkan, Mar 26 2017
STATUS
approved