login
A147665
a(n) = a(a(n - 1)) + r(n) for n >= 3, where r(3*k) = a(a(k)), r(3*k+1) = a(a(k)) and r(3*k+2) = a(n-a(k)), with a(0) = 0 and a(1) = a(2) = 1.
11
0, 1, 1, 2, 2, 3, 3, 3, 5, 4, 3, 6, 4, 3, 6, 5, 5, 9, 6, 5, 12, 6, 5, 15, 8, 8, 11, 8, 7, 11, 8, 7, 14, 9, 7, 14, 8, 7, 10, 5, 5, 13, 6, 6, 13, 6, 6, 9, 7, 6, 9, 8, 9, 17, 12, 7, 12, 7, 6, 15, 9, 8, 14, 9, 7, 18, 9, 7, 12, 9, 9, 16, 10, 8, 14, 11, 11, 15, 11, 12, 13, 8, 10, 14, 9, 7, 15, 11, 12, 15
OFFSET
0,4
LINKS
FORMULA
a(n) = a(a(n - 1)) + r(n) for n >= 3, where r(3*k) = a(a(k)), r(3*k+1) = a(a(k)) and r(3*k+2) = a(n-a(k)), with a(0) = 0 and a(1) = a(2) = 1.
MATHEMATICA
a[n_]:= a[n]= If[n<3, Floor[(n+1)/2], a[a[n-1]] + If[Mod[n, 3]<2, a[a[Floor[n/3]]], a[n - a[Floor[n/3]]]]];
Table[f[n], {n, 0, 100}]
PROG
(Python)
def A147665(n):
if n <= 2: return [0, 1, 1][n]
elif n % 3 <= 1: return A147665(A147665(n-1)) + A147665(A147665(n//3))
else: return A147665(A147665(n-1)) + A147665(n - A147665(n//3))
print([A147665(n) for n in range(100)]) # Oct 18 2009
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Nov 09 2008
EXTENSIONS
Applied OEIS standards to nomenclature - The Assoc. Editors of the OEIS, Oct 18 2009
Name edited by Petros Hadjicostas, Apr 11 2020
STATUS
approved