[go: up one dir, main page]

login
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

%I #23 Nov 26 2021 17:03:33

%S 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,

%T 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,

%U 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

%N 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.

%H G. C. Greubel, <a href="/A147665/b147665.txt">Table of n, a(n) for n = 0..1000</a>

%F 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.

%t 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]]]]];

%t Table[f[n], {n, 0, 100}]

%o (Python)

%o def A147665(n):

%o if n <= 2: return [0, 1, 1][n]

%o elif n % 3 <= 1: return A147665(A147665(n-1)) + A147665(A147665(n//3))

%o else: return A147665(A147665(n-1)) + A147665(n - A147665(n//3))

%o print([A147665(n) for n in range(100)]) # Oct 18 2009

%Y Cf. A004001, A140473, A143089, A143091, A147871.

%K nonn

%O 0,4

%A _Roger L. Bagula_, Nov 09 2008

%E Applied OEIS standards to nomenclature - The Assoc. Editors of the OEIS, Oct 18 2009

%E Name edited by _Petros Hadjicostas_, Apr 11 2020