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!)
A123143 a(0)=0, a(1)=1, a(2)=2; a(3n) = a(n), a(3n+1) = a(n) + a(n+1), a(3n+2) = a(n+1) + a(n+2). 1
0, 1, 2, 1, 3, 3, 2, 3, 4, 1, 4, 6, 3, 6, 5, 3, 5, 5, 2, 5, 7, 3, 7, 5, 4, 5, 5, 1, 5, 10, 4, 10, 9, 6, 9, 9, 3, 9, 11, 6, 11, 8, 5, 8, 8, 3, 8, 10, 5, 10, 7, 5, 7, 7, 2, 7, 12, 5, 12, 10, 7, 10, 10, 3, 10, 12, 7, 12, 9, 5, 9, 9, 4, 9, 10, 5, 10, 6, 5, 6, 6, 1, 6, 15, 5, 15, 14, 10, 14, 14, 4, 14, 19 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Similar to A002487, but the base is 3.
LINKS
EXAMPLE
a(11) = a(4) +a(5) = a(1) +a(2) +a(2) +a(3) = 2*(a(1) +a(2)) = 6.
MAPLE
a[0]:=0: a[1]:=1: a[2]:=2: for n from 1 to 38 do a[3*n]:=a[n]: a[3*n+1]:=a[n]+a[n+1]: a[3*n+2]:=a[n+1]+a[n+2] od: seq(a[n], n=0..115); # Emeric Deutsch, Oct 07 2006
MATHEMATICA
a[0]=0; a[1]=1; a[2]=2; a[n_]:= Switch[Mod[n, 3], 0, a[n/3], 1, a[(n - 1)/3] + a[(n+2)/3], 2, a[(n+1)/3] + a[(n+4)/3]];
Table[a[n], {n, 0, 100}] (* Robert G. Wilson v, Oct 07 2006 *)
PROG
(Magma)
function a(n) // a = A123143
if n le 2 then return n;
elif (n mod 3) eq 0 then return a(Floor(n/3));
elif (n mod 3) eq 1 then return a(Floor((n-1)/3)) + a(1 + Floor((n
-1)/3));
else return a(1 + Floor((n-2)/3)) + a(2 + Floor((n-2)/3));
end if;
end function;
[a(n): n in [0..100]]; // G. C. Greubel, Jul 16 2023
(SageMath)
def a(n): # a = A123143
if n<3: return n
elif (n%3)==0: return a(n//3)
elif (n%3)==1: return a((n-1)//3) + a((n+2)//3)
else: return a((n+1)//3) + a((n+4)//3)
[a(n) for n in range(101)] # G. C. Greubel, Jul 16 2023
CROSSREFS
Cf. A002487.
Sequence in context: A234200 A102746 A287618 * A128133 A032434 A002347
KEYWORD
nonn
AUTHOR
WAGNER Kurt (wagner.kurt(AT)chello.at), Oct 01 2006
EXTENSIONS
More terms from Robert G. Wilson v and Emeric Deutsch Oct 07 2006
STATUS
approved

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 24 13:07 EDT 2024. Contains 371945 sequences. (Running on oeis4.)