login
A284397
a(1) = 1, a(2) = 2; a(n) is the largest prime <= (a(a(n-1)) + a(n-a(n-2)-1)) for n > 2.
3
1, 2, 3, 3, 3, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 11, 11, 7, 7, 11, 11, 11, 11, 11, 11, 11, 11, 13, 17, 17, 13, 13, 13, 17, 17, 13, 13, 17, 17, 17, 17, 17, 17, 17, 17, 19, 23, 19, 17, 23, 19, 19, 19, 23, 23, 19, 19, 23, 23, 19, 19, 23, 23, 23, 23, 23, 23, 23, 23, 23
OFFSET
1,2
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