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

a(1)=1, a(n)=3*a(n-1) if n is not a multiple of 3, or a(n)=a(n/3)+1 if n is a multiple of 3.
0

%I #5 Mar 30 2012 18:39:17

%S 1,3,2,6,18,4,12,36,3,9,27,7,21,63,19,57,171,5,15,45,13,39,117,37,111,

%T 333,4,12,36,10,30,90,28,84,252,8,24,72,22,66,198,64,192,576,20,60,

%U 180,58,174,522,172,516,1548,6,18,54,16,48,144,46,138,414,14,42,126,40,120

%N a(1)=1, a(n)=3*a(n-1) if n is not a multiple of 3, or a(n)=a(n/3)+1 if n is a multiple of 3.

%C b(1)=1, b(n)=3*b(n/3) if n is a multiple of 3, or b(n)=b(n-1)+1 if n is not a multiple of 3 produces the sequence 1, 2, 3, 4, ...

%o (PARI) a(n)=if(n<2,1,if(n%3,3*a(n-1),1+a(n/3)))

%K nonn

%O 1,2

%A _Benoit Cloitre_, May 04 2003