Suppose, our initials are $a_{1,0}=0$
, $a_{1,1}=1$
and $a_{1,j}=0$
for $j<0$
. For given an integer $n$
, define
$$a_{i,j}=\begin{cases} a_{i-1,\frac{j}{2}} & \text{ if $j$ is even},\\
a_{i-1,\frac{j-1}{2}}+a_{i-1,\frac{j+1}{2}} & \text{ if $j$ is odd}
\end{cases}$$
while $2\leq i \leq n$
and $0\leq j \leq 2^{i-1}$
. How can I write an algorithmic TikZ code to generate the following list (e.g.$n=6$
):
The complete code:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
Suppose, our initials are $a_{1,0}=0$, $a_{1,1}=1$ and $a_{1,j}=0$ for $j<0$. For given an integer $n$, define
$$a_{i,j}=\begin{cases} a_{i-1,\frac{j}{2}} & \text{ if $j$ is even},\\
a_{i-1,\frac{j-1}{2}}+a_{i-1,\frac{j+1}{2}} & \text{ if $j$ is odd}
\end{cases}$$
while $2\leq i \leq n$ and $0\leq j \leq 2^{i-1}$
\end{document}
I want the following output:
0 1
0 1 1
0 1 1 2 1
0 1 1 2 1 3 2 3 1
0 1 1 2 1 3 2 3 1 4 3 5 2 5 3 4 1
0 1 1 2 1 3 2 3 1 4 3 5 2 5 3 4 1 5 4 7 3 8 5 7 2 7 5 8 3 7 4 5 1