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”).

A147952
a(0) = 0, a(1) = a(2) = 1, and for n >= 3, a(n) = a(a(n-2)) + r(n), where r(n) = a(a(floor(n/3))) when n == 0 or 1 (mod 3) and = a(n - a(floor(n/3))) when n == 2 (mod 3).
3
0, 1, 1, 2, 2, 3, 2, 3, 4, 3, 3, 5, 3, 4, 5, 4, 5, 7, 4, 4, 6, 4, 4, 8, 4, 6, 6, 4, 4, 8, 4, 6, 10, 5, 6, 7, 4, 5, 9, 5, 5, 8, 6, 7, 7, 5, 5, 10, 6, 6, 7, 5, 6, 8, 4, 6, 8, 4, 6, 8, 4, 6, 10, 4, 5, 8, 5, 6, 8, 6, 8, 6, 6, 4, 10, 4, 5, 8, 5, 6, 13, 4, 6, 8, 4, 6, 8, 6, 8, 6, 6, 4, 10, 4, 5, 8, 6, 7, 10, 6, 6
OFFSET
0,4
FORMULA
a(n) = a(a(n - 2)) + If[Mod[n, 3] == 0, a(a(n/3)), If[Mod[n, 3] == 1, a(a((n - 1)/3)), a(n - a((n - 2)/3))] for n >= 3 with a(0) = 0 and a(1) = a(2) = 1. [edited by Petros Hadjicostas, Apr 13 2020]
MATHEMATICA
f[0] = 0; f[1] = 1; f[2] = 1; f[n_] := f[n] = f[f[n - 2]] + If[Mod[n, 3] == 0, f[f[n/3]], If[Mod[n, 3] == 1, f[f[(n - 1)/3]], f[n - f[(n - 2)/3]]]]; Table[f[n], {n, 0, 100}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Nov 17 2008
EXTENSIONS
Name edited by Petros Hadjicostas, Apr 13 2020
STATUS
approved