OFFSET
1,2
COMMENTS
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, ...
PROG
(PARI) a(n)=if(n<2, 1, if(n%3, 3*a(n-1), 1+a(n/3)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, May 04 2003
STATUS
approved