OFFSET
0,3
COMMENTS
Inspired by the "decimation-like sequences" (or "suites du lezard", after Delahaye) of Eric Angelini.
This sequence is a generalization of sequence A000120, which is defined recursively by a(0)=0, a(2n)=a(n) and a(2n+1)=1+a(n). Its subsequence of even term is thus the original sequence while its subsequence of odd terms yields the original sequence augmented by 1.
REFERENCES
Article by J-P. Delahaye in Pour la Science, mars 2007.
EXAMPLE
Removing parenthesised terms
(0),1,2,(1),3,2,(2),4,3,(1),3,5,(3),4,..
leaves
1,2, 3,2, 4,3, 3,5, 4,..
which is the original sequence with 1 added to each term.
MAPLE
liz:=n->if n=0 then 0 elif modp(n, 3)=0 then liz(n/3) else 1+liz(n-1-floor(n/3)) fi;
MATHEMATICA
a[0] = 0; a[n_] := a[n] = If[Mod[n, 3] == 0, a[n/3], a[Floor[(2*n - 1)/3]] + 1]; Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Sep 27 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Roland Bacher, Feb 20 2007, Feb 26 2007
STATUS
approved