\documentclass{article}


% \newcommand{\Z}{\mbox{\sf Z\hspace{-5.5pt}Z}}
% \newcommand{\R}
% {\mbox{\sf R\makebox[0pt][r]{\rule{.25pt}{8pt}\rule{4.5pt}{0pt}}}}
\def\Z{\mbox{\bf Z}}
\def\R{\mbox{\bf R}}

\def\floor#1{\left\lfloor#1\right\rfloor}
\def\ceil#1{\left\lceil#1\right\rceil}
\def\a{\alpha}
\def\b{\beta}
\def\g{\gamma}
\def\D{\Delta}
\def\d{\delta}
\def\e{\epsilon}
\def\l{\lambda}
\def\G{\Gamma}
\def\S{\Sigma}

\def\ll{\Big(}
\def\rr{\Big)}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newenvironment{proof}{\par\noindent{\bf Proof. }}{\endbox}
\def\endbox{{\qquad\rule{0.5em}{2ex}\bigskip}}


\begin{document}

\title{Asymptotic behavior of Rauzy's sequence}
\author{David Moews\\
\small Center for Communications Research\\[-0.8ex] 
\small 4320 Westerra Court\\[-0.8ex] 
\small San Diego, CA 92121\\[-0.8ex]
\small USA\\[-0.8ex]
\small\tt dmoews@ccrwest.org}
\date{August 30, 2002}

\maketitle

{\bf Abstract.}  For the sequence $u(n)$ defined by
$$u(1)=x, \qquad u(2)=y, \qquad 
u(n)=u(\floor{n/3})+u(n-\floor{n/3}) \ (n\ge 3),$$
$\lim_{n\rightarrow\infty} u(n)/n$ exists and is approximately
equal to $0.37512046x+0.31243977y$.

\bigskip
\ 
\bigskip

To prove the claimed result, we must make various estimates.
First, however, we prove a lemma on equidistribution mod 1.
For real $x$, let $\{x\}=x-\floor{x}$ be the fractional part
of $x$.

\begin{lemma}  \label{lem0} 
Let $\theta$ be irrational and
$I$ be a subinterval of $[0,1]$ with length $L$.
For $\g$ real and $k\in \Z$, define $z_{I,\theta}(\g,k)$ to be 
1 if $\{\g+k\theta\}\in I$ and 0 otherwise.
Then as $n\rightarrow\infty$, 
${1\over n}\sum_{0\le k<n} z_{I,\theta}(\g,k)
\rightarrow L$ uniformly in $\g$.
\end{lemma}
\begin{proof} 
Let $w(\gamma,n)=\sum_{0\le k<n} z_{I,\theta}(\g,k)$.
Since $\theta$ is irrational, for any real $\g$ and
$v\in [0,1]$, there is at most one
$k\in \Z$ with $\{\g+k\theta\}=v$.
Let $I$ have left endpoint $a$ and right endpoint $b$, so $L=b-a$.
If $L=0$, the previous remark then implies that $w(\g,n)\le 1$ for all $n$,
and if $L=1$, it implies that $w(\g,n)\ge n-1$ for all $n$.
Uniform convergence of $w(\g,n)/n$ is clear in both cases, so let $L\in (0,1)$.
If $a=0$, add $(1-b)/2$ to $a$ and $b$.  This replaces $w(\g,n)/n$ by
$w(\g-(1-b)/2,n)/n$, and the uniform convergence of the latter clearly
implies that of the former.  If $b=1$, similarly, subtract $a/2$ from
$a$ and $b$.  After these changes we may assume $0<a<b<1$.
Let $\min(L/2,a,1-b)>\e>0$.
Any continuous function on $\R/\Z$ can be approximated arbitrarily closely
by a trigonometric polynomial \cite[Theorem 2.5]{korner}.
It follows that there are trigonometric polynomials $R_1(t)$ and $R_2(t)$
such that
$$
\begin{array}{rcccll}
1+\e&\ge&R_1(t)&\ge&1,&\qquad t\in [a,b]; \\
  \e&\ge&R_1(t)&\ge&0,&\qquad t\in [0,a-\e]\cup [b+\e,1]; \\
1+\e&\ge&R_1(t)&\ge&0,&\qquad t\in (a-\e,a)\cup (b,b+\e); \\
     1&\ge&R_2(t)&\ge&1-\e,&\qquad t\in [a+\e,b-\e]; \\
     0&\ge&R_2(t)&\ge& -\e,&\qquad t\in [0,a]\cup [b,1]; \\
     1&\ge&R_2(t)&\ge& -\e,&\qquad t\in (a,a+\e)\cup (b-\e,b).
\end{array}
$$
Let
$$
R_l(t)=\sum_{-m\le j\le m} a_{lj} e^{2\pi ijt}, \qquad l\in\{1,2\}.
$$
Observe that as $\theta$ is irrational, $e^{2\pi ij\theta}\ne 1$
for all $j\ne 0$.  Therefore
\begin{eqnarray*}
{1\over n} \sum_{0\le k < n}
R_l(\{\g+k\theta\})
&=&
{1\over n}
\sum_{0\le k<n} \ \ \sum_{-m\le j\le m} a_{lj} e^{2\pi ij\{\g+k\theta\}}\\
&=&
{1\over n}
\sum_{0\le k<n} \left(a_{l0} + \sum_{-m\le j\le m, j\ne 0} 
a_{lj} e^{2\pi ij(\g+k\theta)}\right)\\
&=&
a_{l0}+
\sum_{-m\le j\le m, j\ne 0} a_{lj} 
e^{2\pi ij\g}
{1\over n}
{e^{2\pi ijn\theta}-1 \over e^{2\pi ij\theta}-1}
\end{eqnarray*}
so
$$
\left|-a_{l0}+
{1\over n} \sum_{0\le k < n}
R_l(\{\g+k\theta\})
\right|
\le {2\over n}
\sum_{-m\le j\le m, j\ne 0}
{|a_{lj}|\over |e^{2\pi ij\theta}-1|}={Z_l\over n},$$
for some constants $Z_1$ and $Z_2$ independent of $\g$.
Now 
$$
\int_0^1 R_l(t) dt = \sum_{-m\le j\le m}
a_{lj} \int_0^1 e^{2\pi ijt} dt = a_{l0}$$
so
$$a_{10}=\int_0^1 R_1(t) dt \le \e + 1\cdot (b-a+2\e)=L+3\e$$
and
$$a_{20}=\int_0^1 R_2(t) dt \ge -\e + 1\cdot (b-a-2\e)=L-3\e.$$
Now, it is clear that $R_1\ge \chi_I\ge R_2$ on $[0,1]$, where
$\chi_I$ is the indicator function of $I$.
It follows that
\begin{eqnarray*}
L+3\e+{Z_1\over n}\ge a_{10}+{Z_1\over n}\ge
{1\over n}\sum_{0\le k<n} R_1(\{\g+k\theta\})
&\ge& 
{w(\g,n)\over n}\\
&\ge&
{1\over n}\sum_{0\le k<n} R_2(\{\g+k\theta\})
\ge
a_{20}-{Z_2\over n}\ge L-3\e-{Z_2\over n}.
\end{eqnarray*}
Letting $\e\rightarrow 0$ concludes the proof.
\end{proof}

\begin{lemma}
\label{lem22}
Fix irrational $\theta$ and a
subinterval $I$ of $[0,1]$ with length $L$.
Allow $\nu\ge 0$, $\b_1\ge \b_0$, and $\gamma$ to vary
in any way such that $\nu\rightarrow 0$ and
$\nu(\b_1-\b_0)^2\rightarrow\infty$.
Then
$$ \sqrt{\nu}
 \sum_{\shortstack{ $\scriptstyle \b\in\Z,$\\ $\scriptstyle \b_0\le \b\le 
\b_1$}}
z_{I,\theta}(\gamma,\b) e^{-\nu(\b-\b_0)^2}\rightarrow
{\sqrt{\pi}L\over 2} $$
and
$$ \sqrt{\nu}
 \sum_{\shortstack{ $\scriptstyle \b\in\Z,$\\ $\scriptstyle \b_0<\b\le \b_1$}}
z_{I,\theta}(\gamma,\b) e^{-\nu(\b-\b_0)^2}\rightarrow
{\sqrt{\pi}L\over 2}.$$
\end{lemma}
\begin{proof}
We prove the first limit; since each term in the sum is bounded by 1,
the second is then clear.
Summation by parts gives, for any $\nu\ge 0$,
\begin{eqnarray}
\sum_{\b_0\le \b\le \b_1} z_{I,\theta}(\g,\beta) e^{-\nu(\b-\b_0)^2}
&=&
\sum_{\b_0\le\b'\le \b_1}
\left(\sum_{\b_0\le\b\le\b'} z_{I,\theta}(\g,\b)\right)
(e^{-\nu(\b'-\b_0)^2} - e^{-\nu(\b'+1-\b_0)^2})\nonumber\\
\label{estt}
&+&
\left(\sum_{\b_0\le\b\le\floor{\b_1}} z_{I,\theta}(\g,\b)\right)
e^{-\nu(\floor{\b_1}+1-\b_0)^2}.
\end{eqnarray}

We now estimate
$\sum_{\b_0\le\b\le \b'} z_{I,\theta}(\g,\b)$.
If $\b'\le\b_0+\nu^{-1/4}$, then
the trivial bound $0\le z_{I,\theta}(\g,\b)\le 1$
gives $\sum_{\b_0\le\b\le \b'} z_{I,\theta}(\g,\b)
=O(\nu^{-1/4})$.  Otherwise, $\b'-\b_0\ge\nu^{-1/4}\rightarrow\infty$, so
we can apply Lemma \ref{lem0} to find that
$\sum_{\b_0\le\b\le \b'} z_{I,\theta}(\g,\b)=
(\b'-\ceil{\b_0}+1)(L+o(1))$.  Putting these estimates together yields
$$
\sum_{\b_0\le\b\le\b'} z_{I,\theta}(\g,\b)=
(\b'-\ceil{\b_0}+1)(L+o(1))+O(\nu^{-1/4}),$$
uniformly in $\b'$.
Substituting this into (\ref{estt}) gives
$$
\sum_{\b_0\le \b\le \b_1} z_{I,\theta}(\g,\beta) e^{-\nu(\b-\b_0)^2}
=
$$
$$
\sum_{\b_0\le\b'\le \b_1}
((\b'-\ceil{\b_0}+1)(L+o(1))+O(\nu^{-1/4}))
(e^{-\nu(\b'-\b_0)^2} - e^{-\nu(\b'+1-\b_0)^2})
$$
$$
+
((\floor{\b_1}-\ceil{\b_0}+1)(L+o(1))+O(\nu^{-1/4}))
e^{-\nu(\floor{\b_1}+1-\b_0)^2}
$$
\begin{eqnarray*}
&=&
(L+o(1))\left(\sum_{\b_0\le\b'\le\b_1}
(\b'-\ceil{\b_0}+1)
(e^{-\nu(\b'-\b_0)^2}-e^{-\nu(\b'+1-\b_0)^2})\right.
\\
&&\ \ \ \ \ \ \ \ \ \ \ \ \ \left.  \vphantom{\sum_{\b_0\le\b'\le\b_1}}
+(\floor{\b_1}-\ceil{\b_0}+1)e^{-\nu(\floor{\b_1}+1-\b_0)^2}\right)
+O(\nu^{-1/4})
\end{eqnarray*}
and applying summation by parts again gives
$$
\sum_{\b_0\le \b\le \b_1} z_{I,\theta}(\g,\beta) e^{-\nu(\b-\b_0)^2}
=
(L+o(1))\left(\sum_{\b_0\le\b\le\b_1} e^{-\nu(\b-\b_0)^2}\right)+O(\nu^{-1/4})
$$
so it is enough to show that
$$
\sqrt{\nu}\sum_{\b_0+1\le\b\le\b_1} e^{-\nu(\b-\b_0)^2}\rightarrow
{\sqrt{\pi}\over 2}.
$$
However, if $\b\ge\b_0+1$, then 
$$
\sqrt{\nu}\int_{\b}^{\b+1} e^{-\nu(\b-\b_0)^2} d\b
\le
\sqrt{\nu} e^{-\nu(\b-\b_0)^2}
\le
\sqrt{\nu}\int_{\b-1}^{\b} e^{-\nu(\b-\b_0)^2} d\b
$$
and substituting $\g=\sqrt{\nu}(\b-\b_0)$ into the integrals yields
$$
\int_{\sqrt{\nu}(\b-\b_0)}^{\sqrt{\nu}(\b-\b_0+1)} e^{-\g^2} d\g
\le
\sqrt{\nu} e^{-\nu(\b-\b_0)^2}
\le
\int_{\sqrt{\nu}(\b-\b_0-1)}^{\sqrt{\nu}(\b-\b_0)} e^{-\g^2} d\g.
$$
Summing these inequalities and recalling that $\nu\rightarrow 0$
proves that
$$
\sqrt{\nu}\sum_{\b_0+1\le\b\le\b_1} e^{-\nu(\b-\b_0)^2}
-
\int_0^{\sqrt{\nu}(\b_1-\b_0)} e^{-\g^2} d\g
\rightarrow 0.
$$
However, $\sqrt{\nu}(\b_1-\b_0)\rightarrow\infty$, so the integral
approaches $\int_0^{\infty} e^{-\g^2} d\g=\sqrt{\pi}/2$.  This proves
the lemma.
\end{proof}

Let $0<p<1$, $a>b\ge 1$, and for $n\in \Z_{>0}$, 
let $$\Sigma_n = \{(\alpha,\beta)\mid\alpha,\beta\in\Z_{\ge 0},
\log n - \log a < - \alpha \log p - \beta \log (1-p) \le \log n - \log b\}$$
and $\sigma_n=\sigma_n(a,b)=\sum_{(\alpha,\beta)\in \Sigma_n}
{\alpha+\beta \choose \alpha}.$
Define the entropy function $H$ by $H(x)=-x\log x-(1-x)\log (1-x)$.

\begin{lemma}  
\label{lem3}
If $\log p/\log (1-p)$ is irrational, $ap<b$, $a(1-p)<b$,
and $\epsilon>0$,
then for all large enough $n$, $\sigma_n/n$ is between 
$-\epsilon + (\log a-\log b)/(a H(p))$ and
$\epsilon + (\log a-\log b)/(b H(p))$.
\end{lemma}
\begin{proof} 
We may interchange $p$ and $1-p$ if necessary to find that, without
loss of generality, $p<{1\over 2}<1-p$.  Also, let $n>\max(a,e)$.
Now, since $ap<b$ and $a(1-p)<b$, fixing $\alpha$ for some $(\alpha,\beta)$
in $\Sigma_n$ determines $\beta$, and vice versa.  It follows that there
are most two $(\a,\b)\in\Sigma_n$ with $\a=0$ or $\b=0$.  Deleting these
will change $\sigma_n$ by at most 2, which is $o(n)$.
We will therefore take the sum in $\sigma_n$ to be over only positive $\a$ 
and $\b$.  We now have the estimate \cite[(1.5)]{bollobas} 
\begin{equation}
\label{eq0}
e^{-1/(6\min(\a,\b))} \sqrt{\a+\b\over2\pi\a\b} e^\psi
\le 
{\a+\b \choose \a}
\le
\sqrt{\a+\b\over2\pi\a\b} e^\psi,
\end{equation}
where
\begin{eqnarray*}
\psi=\psi(\a,\b)&=&(\a+\b)\log(\a+\b)-\a\log \a-\b\log \b\\
&=&\a\log(1+{\b\over \a})+\b\log(1+{\a\over \b}).
\end{eqnarray*}

Let $Q$ be $-\a\log p - \b\log(1-p)$, $\a_0$ be $pQ/H(p)$,
and $\b_0$ be $(1-p)Q/H(p)$.  Observe that 
$Q_{-}\le Q\le Q_{+}$, where $Q_{-}=\log n-\log a$,
$Q_{+}=\log n-\log b$.  Since $-\a_0\log p-\b_0\log(1-p)=Q$,
we can write, for some $\lambda$,
$\a=\a_0+\lambda \log(1-p)$ and $\b=\b_0-\lambda\log p$.
Now
\begin{eqnarray*} 
\partial_\a \psi&=&\log(\a+\b)-\log \a=\log(1+\b/\a), \\
\partial_\b \psi&=&\log(\a+\b)-\log \b=\log(1+\a/\b),\\ 
\partial_{\a\a}\psi&=&1/(\a+\b)-1/\a,\\
\partial_{\a\b}\psi&=&1/(\a+\b),\\
\partial_{\b\b}\psi&=&1/(\a+\b)-1/\b,
\end{eqnarray*}
so if we fix $Q$ and treat $\psi$ as a function of $\lambda$,
$$\partial_\lambda \psi=\log(1-p) \log(1+{\b\over\a}) - \log p \log(1+
{\a\over\b}),$$
$$\partial_{\lambda \lambda} \psi=
{(\log p-\log(1-p))^2\over
\a+\b}
-{(\log (1-p))^2\over\a}-{(\log p)^2\over \b}.$$
We remark that 
\begin{eqnarray*}
\psi|_{\lambda=0}&=&Q,\\
\partial_\lambda \psi|_{\lambda=0}&=&0,\qquad \hbox{and}\\
\partial_{\lambda\lambda}\psi|_{\lambda=0}&=&
{(\log p-\log(1-p))^2\over
\a_0+\b_0}
-{(\log (1-p))^2\over\a_0}-{(\log p)^2\over \b_0}\\
&=&
-{H(p)^3\over Qp(1-p)}.
\end{eqnarray*}.

Either $\a\le \a_0$ or $\b\le \b_0$ and therefore
\begin{eqnarray*}
\partial_{\lambda \lambda} \psi&\le&
-{(\log p)^2-(\log p-\log(1-p))^2\over \b} -{(\log (1-p))^2\over\a}\\
&\le&
\max(
-{(\log p)^2-(\log p-\log(1-p))^2\over \b_0},
-{(\log (1-p))^2\over\a_0})\\
&=&
-{K\over Q}, \qquad \hbox{for some constant $K>0$.}
\end{eqnarray*}
It follows that $\psi\le Q-K\lambda^2/(2Q)$,
so $\psi\le Q_{+}-K\lambda^2/(2Q_{+})$.
Let $\lambda'= (\log n)^{1/2}\log\log n$.
If $|\lambda|>\lambda'$,
then $\psi\le\log n-\log b-K(\log \log n)^2/2$, so
$e^\psi=O(ne^{-K(\log \log n)^2/2})$.
(This, and all succeeding $o$, $O$ and $\Omega$ estimates, are uniform with 
respect to $\a$, $\b$, and $\lambda$.)
But 
$\a\le -(\log n-\log b)/\log p$ and $\b\le -(\log n-\log b)/\log (1-p)$,
so
the part of the sum in $\sigma_n$ we are considering is over
$O((\log n)^2)$ terms.  
As $\sqrt{(\a+\b)/(2\pi\a\b)}$ is clearly bounded,
it follows that the portion of the sum in $\sigma_n$
where $|\lambda|>(\log n)^{1/2}\log \log n$
is $O(n(\log n)^2e^{-K(\log \log n)^2/2})=o(n)$.

Assume from now on that $|\lambda|\le\lambda'$.
If we take $n$ sufficiently large, this will imply that 
$\a\ge\a_0/2$ and $\b\ge\b_0/2$.  Then 
\begin{eqnarray*}
|\partial_{\lambda\lambda}\psi
-
\partial_{\lambda\lambda}\psi|_{\lambda=0}|
&=&
|\lambda|\left(
{(\log (1-p)-\log p)^3\over
(\a_0+\b_0)(\a+\b)}
-{(\log (1-p))^3\over\a_0 \a}-{(\log p)^3\over \b_0 \b}\right)\\
&\le&
2|\lambda|\left(
{(\log (1-p)-\log p)^3\over
(\a_0+\b_0)^2}
-{(\log (1-p))^3\over\a_0^2}-{(\log p)^3\over \b_0^2}\right)\\
&=&2|\lambda|O((\log n)^{-2})\\
&=&O(\log \log n (\log n)^{-3/2}),
\end{eqnarray*}
so 
\begin{eqnarray}
\psi&=&Q-(H(p)^3/(Qp(1-p))+O(\log \log n(\log n)^{-3/2}))\lambda^2/2\nonumber\\
&=&Q-\lambda^2H(p)^3/(2p(1-p)Q)+O((\log \log n)^3(\log n)^{-1/2})\label{eqa}.
\end{eqnarray}
Also, if $|\lambda|\le\lambda'$, we have
$$
\begin{array}{ccccc}
\a/\a_0&=&1 + \lambda\log(1-p)/\a_0 &=& 1+O((\log\log n)(\log n)^{-1/2}),\\
\b/\b_0&=&1 - \lambda\log p/\b_0 &=& 1+O((\log\log n)(\log n)^{-1/2}),\\
(\a+\b)/(\a_0+\b_0)&=&1 + \lambda(\log (1-p)-\log p)/(\a_0+\b_0)
&=& 1+O((\log\log n)(\log n)^{-1/2}),
\end{array}
$$
so 
\begin{eqnarray}
\sqrt{\a+\b\over 2\pi\a\b}&=&\sqrt{\a_0+\b_0 \over 2\pi\a_0\b_0}
(1+O((\log\log n)(\log n)^{-1/2}))\nonumber\\
&=& \sqrt{H(p)\over 2\pi p(1-p)Q}
(1+O((\log\log n)(\log n)^{-1/2}))\label{eqb}.
\end{eqnarray}
Finally, if $|\lambda|\le\lambda'$, then as we have already observed,
\begin{equation}
\label{eqc}
\min(\a,\b)=\Omega(\log n).
\end{equation}
(\ref{eq0}), (\ref{eqa}), (\ref{eqb}), and (\ref{eqc}) then give
\begin{equation}
\label{ea0}
\sigma_n=
\sqrt{H(p)\over 2\pi p(1-p)}\tau_n(1+o(1))+o(n),
\end{equation}
where
$$
\tau_n=
\sum_{\shortstack{$\scriptstyle (\alpha,\beta)\in \Sigma_n$
\\ $\scriptstyle |\lambda|\le \lambda'$}} 
Q^{-1/2} \exp (Q-\lambda^2H(p)^3/(2p(1-p)Q)).
$$
Observe that
\begin{equation}
\label{eaa}
Q_{+}^{-1/2} e^{Q_{-}}
\phi(n,{H(p)^3 \over 2p(1-p)Q_{-}})
\le
\tau_n
\le
Q_{-}^{-1/2} e^{Q_{+}}
\phi(n,{H(p)^3 \over 2p(1-p)Q_{+}}),
\end{equation}
where
$$
\phi(n,\mu)=
\sum_{
\shortstack{$\scriptstyle (\alpha,\beta)\in \Sigma_n$
\\ $\scriptstyle |\lambda|\le \lambda'$}} 
e^{-\mu\lambda^2}.
$$
Our task is now to estimate $\phi(n,\mu)$, where $\mu>0$ and $n$ is large.
For $\beta\in\Z$, let $y(\b)$ be 1 if there exists some $\alpha\in\Z$
with 
\begin{equation}
\label{eqe}
\log n-\log a < -\a\log p-\b\log(1-p)\le \log n - \log b,
\end{equation}
and 0 otherwise.  
Recalling that fixing $\b$ for some $(\a,\b)\in\Sigma_n$
determines $\a$ and that $\lambda=(\b_0-\b)/\log p$, we have
$$
\phi(n,\mu)=\sum_{|\b-\b_0|\le \lambda'|\log p|}
y(\beta) e^{-\mu(\b-\b_0)^2/(\log p)^2}.
$$
We can rewrite (\ref{eqe}) as
$$
-\a <
{\log n-\log a\over\log p}+\beta{\log(1-p)\over\log p}
\le
-\a + {\log a-\log b\over -\log p}
=
-\a + {\log (b/a)\over\log p},$$
and an $\a$ satisfying this will evidently exist just when
$$
\left\{
{\log n-\log a\over\log p}+\beta{\log(1-p)\over\log p}
\right\}\in\left(0,
{\log (b/a)\over\log p}\right].$$
Therefore, if $I=(0,\log(b/a)/\log p]$,
$\theta=\log(1-p)/\log p$, and $\g=(\log n-\log a)/\log p$,
we have $y(\b)=z_{I,\theta}(\g,\b)$, so
$$
\phi(n,\mu)=\sum_{|\b-\b_0|\le \lambda'|\log p|}
z_{I,\theta}(\g,\beta) e^{-\mu(\b-\b_0)^2/(\log p)^2}.
$$
Now $I$ has length $\log(b/a)/\log p$, so
it follows from Lemma \ref{lem22} that, provided that
$\mu\rightarrow 0$ and $\mu\lambda'^2\rightarrow\infty$,
\begin{equation}
\label{eab}
\sqrt{\mu} \phi(n,\mu)\rightarrow \sqrt{\pi} \log(a/b).
\end{equation}
If $\mu$ is a constant divided by either $Q_{-}$ or $Q_{+}$,
it is certainly true that $\mu\rightarrow 0$ and
$\mu\lambda'^2\rightarrow \infty$.
Hence (\ref{eaa}) and (\ref{eab}) yield
\begin{eqnarray}
&&Q_{+}^{-1/2} e^{Q_{-}}
\sqrt{\pi} \log(a/b)
\sqrt{2p(1-p)Q_{-} \over H(p)^3}
(1+o(1))\nonumber\\
&\le&\tau_n\nonumber\\
&\le&
Q_{-}^{-1/2} e^{Q_{+}}
\sqrt{\pi} \log(a/b)
\sqrt{2p(1-p)Q_{+} \over H(p)^3}
(1+o(1)).\label{ec}
\end{eqnarray}
Substituting (\ref{ec}) into (\ref{ea0}) then yields the desired result.
\end{proof}

\begin{lemma}
\label{lem4}
  If $\log p/\log (1-p)$ is irrational, then
$\lim_{n\rightarrow\infty} \sigma_n/n$ exists and equals
$H(p)^{-1}(b^{-1}-a^{-1})$.
\end{lemma}
\begin{proof} 
Fix some integer $m>0$ such that $\log(a/b)/m<\min(-\log p,-\log (1-p))$,
and set $c_i=b(a/b)^{i/m}$, $i=0$, \dots, $m$.  It now follows from
Lemma \ref{lem3} that for all $i=0$, \dots, $m-1$ and for large enough $n$, 
$$
{\log a-\log b\over m c_i H(p)}+{1\over m^2}
\ge
{\sigma_n(c_{i+1}, c_i)\over n}
\ge
{\log a-\log b\over m c_{i+1} H(p)}-{1\over m^2}.
$$
However, $\sigma_n(a,b)=\sum_{0\le i<m} \sigma_n(c_{i+1}, c_i)$, so
summing these inequalities over $i$ gives, for large $n$,
$$
{1\over m} + {\log a-\log b\over m H(p)}\sum_{0\le i<m} c_i^{-1}
\ge
{\sigma_n(a,b)\over n}
\ge
-{1\over m} + {\log a-\log b\over m H(p)}\sum_{0\le i<m} c_{i+1}^{-1}.
$$
However, both ${1\over m}\sum_{0\le i<m} c_i^{-1}$ and 
${1\over m}\sum_{0\le i<m} c_{i+1}^{-1}$ are Riemann sums of the integral
$$
\int_0^1 {1\over b(a/b)^x} dx
= 
{b^{-1}-a^{-1}\over \log a-\log b}
$$
so letting $m\rightarrow\infty$ proves the lemma.
\end{proof}

We now proceed to examine Rauzy's sequence.  For any $x$ and $y$, let 
\begin{eqnarray*}
u_{x,y}(1)&=&x, \\
u_{x,y}(2)&=&y, \\
u_{x,y}(n)&=&u_{x,y}(\floor{n/3})+
u_{x,y}(n-\floor{n/3}), \qquad n \ge 3.
\end{eqnarray*}
It is immediately clear that $u_{1,2}(n)=n$ for all $n$ and so
\begin{eqnarray*}
u_{x,y}(n)&=&(x-{y\over 2})u_{1,0}(n)+ {y\over 2} u_{1,2}(n)\\
&=&(x-{y\over 2})u_{1,0}(n)+{yn\over 2}
\end{eqnarray*}
for all $n$.  To prove that $u_{x,y}(n)/n$ approaches a limit, it will
therefore do to prove that $u_{1,0}(n)/n$ approaches a limit.  
From now on, call $u_{1,0}(n)$ $u(n)$.  Then for positive integers $n$,
\begin{eqnarray*}
u(3n)  &=&u(n)+u(2n),\\
u(3n+1)&=&u(n)+u(2n+1), \\
u(3n+2)&=&u(n)+u(2n+2),
\end{eqnarray*}
so if we write $(\delta u)(m)=u(m+1)-u(m)$, then for positive integers $n$,
\begin{eqnarray*}
(\delta u)(3n)&=&(\delta u)(2n),\\
(\delta u)(3n+1)&=&(\delta u)(2n+1),\\
(\delta u)(3n+2)&=&(\delta u)(n),
\end{eqnarray*}
and $u(1)=1$, $u(2)=0$, $u(3)=u(1)+u(2)=1$, so $(\delta u)(1)=-1$
and $(\delta u)(2)=1$.  It follows by induction that $|(\delta u)(n)|=1$
for all $n$; together with $u(1)=1$, this implies that $u(n)\le n$
for all $n$.

For all nonnegative real $x$,
define $g_0(x)=\floor{x/3}$ and $g_1(x)=\ceil{2x/3}$,
let the set of finite length words of 0s and 1s be $\{0,1\}^*$, and
for each $w=w_1\cdots w_k\in\{0,1\}^*$, define
$g_w = g_{w_1}\circ \cdots\circ g_{w_k}.  $
Then for all positive integers $n>m\ge 2$,
\begin{equation}
\label{e8}
u(n)=
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle g_w(n)>m$\\
$\scriptstyle g_{0w}(n)\le m$
}}
u(g_{0w}(n))
+
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle g_w(n)>m$\\
$\scriptstyle g_{1w}(n)\le m$
}}
u(g_{1w}(n)).
\end{equation}
Fix $n$, and
for all nonnegative real $x$, set $h_0(x)=x/3$, $h_1(x)=2x/3$, and
$h_w = h_{w_1}\circ \cdots\circ h_{w_k}$ for $w\in\{0,1\}^*$.
We have
$|g_j(x)-h_j(x)|\le 1$ for $j\in\{0,1\}$.
It follows by induction on the length of $w$ that $|g_w(x)-h_w(x)|\le 3$
for $w\in\{0,1\}^*$.
Also, if $m$ is an even integer,
then for integral $n$, $g_{0w}(n)\le m$ iff $g_w(n)\le 3m+2$
and $g_{1w}(n)\le m$ iff $g_w(n)\le 3m/2$, so
we can rewrite (\ref{e8}) as
\begin{eqnarray}
u(n)&=&
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle 3m+2\ge g_w(n)\ge m+1$
}}
u(g_0(g_w(n)))
+
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle 3m/2\ge g_w(n)\ge m+1$
}}
u(g_1(g_w(n)))\nonumber
\\
&=&
S_0(3m+2,m+1)+S_1(3m/2,m+1),\label{fe1}
\end{eqnarray}
where we write
$$
S_j(a,b)=\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle a\ge g_w(n)\ge b$
}} u(g_j(g_w(n))).
$$
Now if we also write
$$
T_j(a,b)=
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle a> h_w(n)\ge b$
}} 
u(g_j(g_w(n))).
$$
then for all $a\ge b+6$,
$$
S_j(a,b)=
T_j(a-3,b+3)
+
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle a+3\ge h_w(n)\ge a-3$\\
$\scriptstyle a\ge g_w(n)\ge b$
}}
u(g_j(g_w(n)))
+
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle b+3>h_w(n)\ge b-3$\\
$\scriptstyle a\ge g_w(n)\ge b$
}}
u(g_j(g_w(n)))
$$
so
\begin{equation}
\label{fe2}
|S_j(a,b)-T_j(a-3,b+3)|\le T_j(a+4,a-3)+T_j(b+3,b-3).
\end{equation}
Now if $w\in\{0,1\}^*$ and $h_w(x)\ge 6$, as
$|h_w(x)-g_w(x)|\le 3$, we have $g_w(x)\ge 3$.
It follows that
if $j\in\{0,1\}$, then $|g_j(h_w(x))-g_j(g_w(x))|\le 2$.
Now since $g_j(h_w(x))\ge g_j(6)\ge 2$ and $g_j(g_w(x))\ge g_j(3)\ge 1$,
$u(g_j(h_w(x)))$ and $u(g_j(g_w(x)))$ are defined, and since
$|(\delta u)(n)|=1$ for all positive integral $n$,
$|u(g_j(g_w(x)))-u(g_j(h_w(x)))|\le 2$.
Therefore, if we set
\begin{eqnarray*}
U_j(a,b)&=&
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle a>h_w(n)\ge b$
}} 
u(g_j(h_w(n))),\\
V(a,b)&=&
\sum_{
\shortstack{
$\scriptstyle w\in\{0,1\}^*$\\
$\scriptstyle a>h_w(n)\ge b$
}} 
1,
\end{eqnarray*}
we have, for $b\ge 6$,
\begin{equation}
\label{fe3}
|T_j(a,b)-U_j(a,b)|\le 2 V(a,b).
\end{equation}
Combining (\ref{fe1}), (\ref{fe2}), and (\ref{fe3}) now yields,
if $m\ge 14$,
$$
|u(n)-U_0(3m-1,m+4)-U_1(3m/2-3,m+4)|\le
$$
$$
U_0(3m+6,3m-1)+U_0(m+4,m-2)+U_1(3m/2+4,3m/2-3)+U_1(m+4,m-2)+
$$
$$
2V(3m+6,3m-1)+4V(m+4,m-2)+2V(3m/2+4,3m/2-3)+
$$
\begin{equation}
\label{fea}
2V(3m-1,m+4)+2V(3m/2-3,m+4).
\end{equation}
Now if $x\le a$, $j\in\{0,1\}$, $u(g_j(x))$ is defined, and $a$ is integral, 
then $u(g_j(x))\le g_j(x)\le g_j(a)\le a$, so
\begin{equation}
\label{feb}
U_j(a,b)\le aV(a,b)\qquad 
\hbox{($j\in\{0,1\}$, $a$, $b$ integral, $b\ge 3$.)}
\end{equation}
Also, if $j\in\{0,1\}$, $i$ is a positive integer and $x\in[i,i+1)$,
then $|g_j(x)-g_j(i)|\le 1$, so if $u(g_j(i))$ is defined,
$|u(g_j(x))-u(g_j(i))|\le 1$.  This means that
\begin{equation}
\label{fec}
\left|
U_j(a,b)-\sum_{a>i\ge b} u(g_j(i)) V(i+1,i)\right|
\le V(a,b)
\qquad
\hbox{($j\in\{0,1\}$, $a$, $b$ integral, $b\ge 3$.)}
\end{equation}
Substituting (\ref{feb}) and (\ref{fec}) into (\ref{fea}) yields
$$
\left|
u(n)
-
\sum_{3m-1>i\ge m+4} u(g_0(i)) V(i+1,i)
-
\sum_{3m/2-3>i\ge m+4} u(g_1(i)) V(i+1,i)
\right|
\le
$$
$$
(3m+8)V(3m+6,3m-1)+(2m+12)V(m+4,m-2)+(3m/2+6)V(3m/2+4,3m/2-3)
$$
\begin{equation}
\label{fed}
+3V(3m-1,m+4)+3V(3m/2-3,m+4).
\end{equation}
Now observe that, if the word $w$ has $\a$ 0s and $\b$ 1s, 
$h_w(x)=({1\over 3})^\a({2\over 3})^\b x$.  Therefore,
if we set $p={1\over 3}$, $V(a,b)=\sigma_n(a,b)$.
Now fix $m\ge 50$, divide (\ref{fed}) by $n$ and let $n$ tend to infinity.  We 
can then apply Lemma \ref{lem4} to find that for any $\epsilon>0$, 
\begin{equation}
\label{fee}
\left|
{u(n)\over n}
-
\sum_{3m-1>i\ge m+4} {u(g_0(i))\over H({1\over 3})i(i+1)}
-
\sum_{3m/2-3>i\ge m+4} {u(g_1(i)) \over H({1\over 3})i(i+1)}
\right|
\le
\epsilon+{23\over H({1\over 3})m}
\end{equation}
for sufficiently large $n$.
Letting $\epsilon=1/m$ and $m\rightarrow \infty$ now immediately proves
that $\lim_{n\rightarrow\infty} u(n)/n$ exists, as claimed.
Furthermore, it follows immediately from (\ref{fee}) that
if this limit is $\cal L$, then
\begin{equation}
\label{fef}
\left|
{\cal L}
-
\sum_{3m-1>i\ge m+4} {u(g_0(i))\over H({1\over 3})i(i+1)}
-
\sum_{3m/2-3>i\ge m+4} {u(g_1(i)) \over H({1\over 3})i(i+1)}
\right|
\le
{23\over H({1\over 3})m}
\qquad \hbox{$(m\ge 50)$}.
\end{equation}
Obviously, this allows us to compute $\cal L$ to any desired degree
of accuracy.  In fact, taking $m=10^9$, we find that 
${\cal L}=0.37512046\pm 4\cdot 10^{-8}$.  Finally we remark that
for all $x$ and $y$,
$$
\lim_{n\rightarrow\infty} {u_{x,y}(n)\over n}
=
(x-{y\over 2}){\cal L}+{y\over 2}
=
(0.37512046\pm 4\cdot 10^{-8})x+(0.31243977\pm2\cdot 10^{-8})y.
$$
\begin{thebibliography}{9}
\bibitem{bollobas} 
B.~Bollob\'as, {\em Random Graphs}, 2nd ed.,
Cambridge University Press, 2001.
\bibitem{korner}
T.~W.~K\"orner, {\em Fourier Analysis},
paperback ed., Cambridge University Press, 1989.
\end{thebibliography}
\end{document}
