6
$\begingroup$

I saw a problem on this forum concerning the number

$$T = 1 + \frac{2 +\frac{3+ \frac {4+...}{5+...}}{4+\frac{5+...}{6+...}} }{3 + \frac{4+\frac{5+...}{6+...}}{5+\frac{6+...}{7+...}}}$$

whose rule is "simple": you add $+1$ as you go up and add $+2$ as you go down, indeed this number can be thought as one of the values of $f(0)$ when $f(x) = x+1 +\frac{f(x+1)}{f(x+2)}$. So I tried to put these numbers on a sequence $a_n$ by dividing this fraction on levels established by the division line.

For example, on level one we would have the element $a_1=1$. Because we're done with this level we move to the top of the next level.

Level $2$ is the level which starts with $2$ and only has the elements $a_2=2$ and $a_3=3$. We move to level $3$.

Level $3$ has four elements, it starts at $a_4=3$ then we go down: $a_5=4,a_6=4,a_7=5$ and on level $4$ we have $a_8=4, a_9=5,a_{10} = 5, a_{11} = 6, a_{12}=5, a_{13}=6, a_{14} = 6, a_{15} = 7$.

What I want is a general formula for the terms of sequence $a_n$:

$$(a_n) = (1,2,3,3,4,4,5,4,5,5,6,5,6,6,7,5,6...)$$

It is clear that the $i$-th level has $2^{i-1}$ elements, so I thought about defining $b_{i,j}$ as the $j$-th term of the $i$-th level ($1 \le j \le 2^{i-1}$). As $i =\lfloor \log_2 n \rfloor +1$, we have $a_n = b_{\lfloor \log_2 n \rfloor +1, n -\lfloor \log_2 n \rfloor}$, my problem now is finding the pattern in the levels.

It is easy to see that $b_{i,1} = i$ for all $i \geq 1$ and that $b_{i,2^{i-1}} = 2i-1$. I used the following recurrence relations to try to establish this formula:

$$\begin{cases}b_{i+1,2j} = b_{i,j} + 2 \\ b_{i+1, 2j-1} = b_{i,j} + 1\\ b_{i,1}=i\end{cases}$$

which should translate the property of "up = $+1$", "down = $+2$" and that each level starts with $i$ but I'm not sure why this isn't enough. We can see it fails on the level $4$ when we repeat the fraction $\frac56$. But how can I conclude that in the middle this happens? The expression $b_{i,j} = i + \lfloor \frac j2 \rfloor$ seems to describe the level until half of it, how can I fix this and get a formula? Is it enough to split the level in two parts?

EDIT: I saw this is really a graph and it seems that the repetition of terms follows the Pascal triangle, which I mean by this is that on the level $5$ the repetition goes like $1,4,6,4,1$: $1$ five, $4$ sixes, $6$ sevens, $4$ eights and $1$ nine. This is easy to prove with induction I believe.

EDIT²: here is the original question Simplifying a complicated continued fraction expression.

EDIT³: I managed to prove that $b_{i,4k-1} = b_{i,4k-2}$ for all $k \geq 1$ and any $i \geq 3$, those are indeed the only consecutive positions on the level on which equality occurs.

EDIT4: The problem is now equivalent to find a formula for the elements of the following sequence of vectors:

$$b_3 = [-1], b_4 = [-1,-2,-1] , b_5 = [-1,-2,-1,-3,-1,-2,-1] ,..., b_n$$

with $b_{n+1} = b_n + [2-n] + b_n$ where the plus means concatenation of lists/vectors and $[2-n]$ is a vector with the element $2-n$. This last task is holding me, a formula for $b_{n,k}$ is a formula for $a_n$

$\endgroup$
4
  • 3
    $\begingroup$ oeis.org/A056792 might help $\endgroup$
    – EnEm
    Commented Jul 6 at 11:25
  • $\begingroup$ thanks, I already made a Python program that gives out these terms, I need to think on why the recurrence is failing me. $\endgroup$ Commented Jul 6 at 11:32
  • 1
    $\begingroup$ What do you mean by "We can see it fails on the level 4 when we repeat the fraction 5/6" ? I don't see your recurrence failing anywhere. $\endgroup$
    – EnEm
    Commented Jul 6 at 11:37
  • $\begingroup$ you're right, I confused my equations with my attempted solution $i + \lfloor \frac j2 \rfloor$. I must find a way to solve the recurrence for a fixed $i$ then. $\endgroup$ Commented Jul 6 at 11:39

1 Answer 1

2
$\begingroup$

We derive a formula for the sequence \begin{align*} \left(a_n\right)_{n\geq 1}=\left(1,2,3,3,4,4,5,4,5,5,6,5,6,6,7,5,6,\ldots\right) \end{align*} based upon simpler building blocks.

We consider \begin{align*} \begin{array}{rcccc} n&\color{blue}{a_n}&\lfloor\log_2(n)\rfloor&\left(n-2^{\lfloor\log_2(n)\rfloor}\right)_2&w_h\left(\left(n-2^{\lfloor\log_2(n)\rfloor}\right)_2\right)\\ \hline 1&\color{blue}{1}&0&0&0\\ \hline 2&\color{blue}{2}&1&0&0\\ 3&\color{blue}{3}&1&1&1\\ \hline 4&\color{blue}{3}&2&00&0\\ 5&\color{blue}{4}&2&01&1\\ 6&\color{blue}{4}&2&10&1\\ 7&\color{blue}{5}&2&11&2\\ \hline 8&\color{blue}{4}&3&000&0\\ 9&\color{blue}{5}&3&001&1\\ 10&\color{blue}{5}&3&010&1\\ 11&\color{blue}{6}&3&011&2\\ 12&\color{blue}{5}&3&100&1\\ 13&\color{blue}{6}&3&101&2\\ 14&\color{blue}{6}&3&110&2\\ 15&\color{blue}{7}&3&111&3\\ \hline \end{array} \end{align*}

  • The column $\lfloor\log_2(n)\rfloor$ divides the numbers $a_n$ into blocks of length $2^n$ and gives the depth or level of the numbers of $a_n$ as indicated by OP in the representation of $T$

  • Within each block of length $2^n$ we list the numbers $0$ to $2^{n-1}$ as binary numbers.

  • Key observation is that the number of $1$s in the binary representation needs to be added to obtain $a_n$. This is called the hamming weight of the number.

We obtain from the table above \begin{align*} \color{blue}{a_n}&\color{blue}{=1+\lfloor\log_2(n)\rfloor+w_h\left(\left(n-2^{\lfloor\log_2(n)\rfloor}\right)_2\right)\qquad\qquad n\geq1}\\ \end{align*}

$\endgroup$
2
  • $\begingroup$ the term $a_{12} =5$, your formula works but your table is wrong $\endgroup$ Commented Jul 7 at 20:24
  • $\begingroup$ @hellofriends: Many thanks. Typo corrected. $\endgroup$ Commented Jul 7 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .