[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A284383
a(1) = 1, a(2) = 2, a(3) = 3, a(4) = 2; a(n) is the largest composite number <= (a(n-a(n-1)) + a(n-a(n-2))) for n > 4.
4
1, 2, 3, 2, 4, 4, 6, 4, 6, 6, 8, 6, 10, 6, 10, 10, 12, 8, 14, 10, 14, 10, 16, 10, 16, 16, 16, 12, 22, 12, 20, 16, 22, 14, 24, 16, 24, 16, 26, 16, 26, 26, 24, 18, 30, 22, 28, 26, 30, 20, 34, 24, 36, 20, 38, 24, 36, 24, 40, 26, 38, 26, 40, 26, 42, 26, 42, 42, 32, 28, 50, 28, 46, 34
OFFSET
1,2
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