login
A284374
a(1) = a(2) = 1; a(n) is the largest prime <= (a(n-a(n-1)) + a(n-a(n-2))) for n > 2.
5
1, 1, 2, 3, 3, 3, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 13, 11, 7, 11, 13, 11, 13, 13, 13, 13, 13, 13, 13, 23, 13, 11, 19, 19, 13, 23, 19, 13, 23, 23, 19, 19, 23, 23, 19, 23, 23, 23, 23, 23, 23, 23, 43, 19, 29, 31, 23, 23, 43, 31, 31, 23, 31, 37, 31, 23, 43, 31, 23, 43, 31
OFFSET
1,3
FORMULA
a(1) = a(2) = 1; a(n) = A007917(a(n-a(n-1)) + a(n-a(n-2))) for n > 2.
EXAMPLE
a(4) = 3 because a(4 - a(3)) + a(4 - a(2)) = a(2) + a(3) = 1 + 2 = 3 and A007917(3) = 3.
MATHEMATICA
a[1] = a[2] = 1; a[n_] := a[n] = Prime@ PrimePi[a[n - a[n - 1]] + a[n - a[n - 2]]]; Array[a, 73] (* Michael De Vlieger, Mar 25 2017 *)
PROG
(PARI) a=vector(1000); a[1]=a[2]=1; for(n=3, #a, a[n] = precprime(a[n-a[n-1]]+a[n-a[n-2]])); a
CROSSREFS
KEYWORD
nonn
AUTHOR
Altug Alkan, Mar 25 2017
STATUS
approved