OFFSET
1,2
LINKS
Altug Alkan, Table of n, a(n) for n = 1..10000
Altug Alkan, Alternative scatterplot of A284383
Altug Alkan, Illustration for A284383
FORMULA
a(1) = 1, a(2) = 2, a(3) = 3; a(n) = a(n-a(n-1)) + a(n-a(n-2)) - A010051(a(n-a(n-1)) + a(n-a(n-2))) for n > 3.
EXAMPLE
a(5) = 4 because a(5 - a(4)) + a(5 - a(3)) = a(3) + a(2) = 3 + 2 = 5 and largest composite number <= 5 is 4.
MATHEMATICA
a[n_] := a[n] = If[n <= 4, n - 2 Boole[n == 4], k = 0; While[! CompositeQ@ Set[m, a[n - a[n - 1]] + a[n - a[n - 2]] - k], k++]; m]; Array[a, 74] (* Michael De Vlieger, Mar 29 2017 *)
PROG
(PARI) f(n) = n-isprime(n);
a=vector(1000); a[1]=1; a[2]=2; a[3]=3; for(n=4, #a, a[n] = f(a[n-a[n-1]]+a[n-a[n-2]])); a
CROSSREFS
KEYWORD
nonn
AUTHOR
Altug Alkan, Mar 26 2017
STATUS
approved