login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A147954 a(0) = 0, a(1) = a(2) = 1, a(n) = a(a(n-1)) + a(n-a(n-1)) for 3 <= n <= 5, and a(n) = a(a(n-1)) + r(n) for n >= 6, where r(n) = a(a(floor(n/6))) for n == 0, 1, 2, 3, 4 (mod 6), and r(n) = a(n - a(floor(n/6))) for n == 5 (mod 6). 1

%I #27 Dec 28 2023 19:29:47

%S 0,1,1,2,2,3,3,3,3,3,3,5,4,3,3,3,3,5,4,3,3,3,3,5,4,3,3,3,3,5,5,5,5,5,

%T 5,8,5,5,5,5,5,8,5,5,5,5,5,8,5,5,5,5,5,8,5,5,5,5,5,8,5,5,5,5,5,8,6,6,

%U 6,6,6,9,5,5,5,5,5,8,5,5,5,5,5,8,5,5,5

%N a(0) = 0, a(1) = a(2) = 1, a(n) = a(a(n-1)) + a(n-a(n-1)) for 3 <= n <= 5, and a(n) = a(a(n-1)) + r(n) for n >= 6, where r(n) = a(a(floor(n/6))) for n == 0, 1, 2, 3, 4 (mod 6), and r(n) = a(n - a(floor(n/6))) for n == 5 (mod 6).

%p a := proc(n) local v; option remember;

%p if n = 0 then v := 0; end if;

%p if n = 1 or n = 2 then v := 1; end if;

%p if 3 <= n and n <= 5 then v := a(a(n - 1)) + a(n - a(n - 1)); end if;

%p if 6 <= n and 5 <> n mod 6 then v := a(a(n - 1)) + a(a(floor(n/6))); end if;

%p if 6 <= n and 5 = n mod 6 then v := a(a(n - 1)) + a(n - a(floor(n/6))); end if; v; end proc; # _Petros Hadjicostas_, Apr 21 2020

%t f[0] = 0; f[1] = 1; f[2] = 1;

%t f[n_] := f[n] =

%t f[f[n - 1]] +

%t If[n < 6, f[n - f[n - 1]],

%t If[Mod[n, 6] == 0, f[f[n/6]],

%t If[Mod[n, 6] == 1, f[f[(n - 1)/6]],

%t If[Mod[n, 6] == 2, f[f[(n - 2)/6]],

%t If[Mod[n, 6] == 3, f[f[(n - 3)/6]],

%t If[Mod[n, 6] == 4, f[f[(n - 4)/6]], f[n - f[(n - 5)/6]]]]]]]];

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

%Y Cf. A004001, A147665, A147955.

%K nonn

%O 0,4

%A _Roger L. Bagula_, Nov 17 2008

%E Name, data, and Mathematica program edited and corrected by _Petros Hadjicostas_, Apr 21 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 06:49 EDT 2024. Contains 371964 sequences. (Running on oeis4.)