Wednesday, May 8, 2024

The limit of an averaging sequence

Consider this sequence of length $n$: $P_n=(p_0,p_1,p_2,\dots,p_{n-1})$, where $p_0=2$, and each time the next number $p_k$ can be any number within $[2,1+p_{k-1}]$ for $k\in [1,n-1]$. Consider the set of all such sequences of length $n$, $\{P_n\}$. The first few sets are:
\begin{align*}n=1:& (2)\\
n=2:& (2,2),(2,3)\\
n=3:& (2,2,2),(2,2,3),(2,3,2),(2,3,3),(2,3,4)\\
n=4:& (2,2,2,2),(2,2,2,3),(2,2,3,2),(2,2,3,3),(2,2,3,4),(2,3,2,2),(2,3,2,3),(2,3,3,2),\\
 &(2,3,3,3),(2,3,3,4),(2,3,4,2),(2,3,4,3),(2,3,4,4),(2,3,4,5)
\end{align*}
Let $P_{nj}$ be any path in $\{P_n\}$, and $\prod P_{nj}$ be the product of all the numbers in that path. The question is, what is this limit: $\text{lim}_{n\rightarrow\infty} \sum_{P_{nj}\in \{P_n\}} (\prod P_{nj})^{-1}$?

The first few sums are

$$
\renewcommand\arraystretch{1.5}
\begin{matrix}
    n=1:& \frac{1}{2}\\
    n=2:& \frac{1}{2}\frac{1}{2}+\frac{1}{2}\frac{1}{3}\\
    n=3:& \frac{1}{2}\frac{1}{2}\frac{1}{2}+\frac{1}{2}\frac{1}{2}\frac{1}{3}+\frac{1}{2}\frac{1}{3}\frac{1}{2}+\frac{1}{2}\frac{1}{3}\frac{1}{3}+\frac{1}{2}\frac{1}{3}\frac{1}{4}
\end{matrix}$$

Answer: The limit is $e^{-1}$.
How do you prove that it converges to this value?

Monday, May 6, 2024

IBM Ponder this 2024 04 solution

Problem description, and the solution.
Hey, this time I got first place! Although there's not much to talk about.
The problem looks like a finite state machine problem. The states can be represented by a length $n$ ternary number, where the lowest digit represents the location of the largest disk, the second digit is the location of the second largest one, and so on. After each step, it transits to the next state, depending on the move.
The solution can be found by, like the solution page says, finding the periods of the sequences. Both the state and the move must be considered.

Or, just simulate the entire process. Out of all the problems that I've solved so far, this one is the most brute-forcible, if that's a word.
Each game is represented by 3 integer arrays, which correspond to the disks on the 3 rods, and a index of the move. Each time, read the move and change the arrays accordingly.
Usually the simulation of the periodic increment of the index is implemented as something like
  i=(i+1)%size;
or
  i=i+1;
  if(i==size) i=0;
But modulo and branching are costly operations, and the routine is called many times. To make it faster, I replaced it with a lookup table. The speedup is not huge, 90s to 63s, but still quite noticeable.

A Recursive Geometric Proof for 1962 IMO Problem 6

Youtube recommended a video to me, where the following problem is solved: Consider an isosceles triangle. Let $R$ be the radius of its circ...