login
a(1) = 1, a(2) = 0, a(n) = a(floor(n/3)) + a(n - floor(n/3)).
3

%I #24 Jan 02 2022 17:12:51

%S 1,0,1,2,3,2,3,2,3,4,3,4,5,6,7,6,7,6,7,8,9,10,9,8,9,8,9,10,11,12,13,

%T 14,13,12,11,12,13,12,13,14,15,16,17,18,19,20,21,20,19,18,19,18,19,18,

%U 19,18,19,20,21,22,23,24,25,26,27,28,29,30,29,30,29,28,27,26,27,28,27,26

%N a(1) = 1, a(2) = 0, a(n) = a(floor(n/3)) + a(n - floor(n/3)).

%C "Rauzy's sequence" with initial values 1, 0.

%C David Moews showed that a(n)/n converges to about 0.37512. - _Jim Nastos_, Jan 08 2003

%C Difference of consecutive terms is always +/- 1.

%H Gheorghe Coserea, <a href="/A071995/b071995.txt">Table of n, a(n) for n = 1..10000</a>

%H David Moews, <a href="http://djm.cc/dmoews/rauzy.pdf">Asymptotic behavior of Rauzy's sequence</a>

%H Jeffrey Shallit, <a href="http://www.cs.uwaterloo.ca/~shallit/Talks/pmc2.ps">Ten Problems I Can't Solve (1.1 MB ps)</a>

%t a[1]=1; a[2]=0; a[n_] := a[n]=a[Floor[n/3]]+a[n-Floor[n/3]]; Table[a[n], {n, 1, 80}]

%o (PARI)

%o n = 33; v = vector(n); v[1] = 'x; v[2] = 'y;

%o for(i = 3, n, v[i] = v[floor(i/3)] + v[i - floor(i/3)]);

%o apply(e -> polcoeff(e, 1, v[1]), v) \\ _Gheorghe Coserea_, Aug 22 2015

%Y Cf. A071991, A071996.

%K easy,nonn

%O 1,4

%A _Jim Nastos_, Jun 17 2002

%E Edited by _Robert G. Wilson v_, Jun 23 2002