A lovely puzzle from @jsiehler on Mathstodon:

A problem I wrote for a competition some time ago (but decided not to use): Let $a_n$ denote the nearest integer to $\log_{168}(927^n)$, and let $b_n = a_{n-1} - a_{n}$. The first few terms in the sequence are $2, 1, 1, 2, 1, 1\dots$, which appears to be a sequence of period 3. Does the repeating 2,1,1 pattern continue indefinitely? Prove your answer.

You might want to have a play with it yourself before I spoiler it below the line.


You don’t need a calculator for this one, at least not for the puzzle itself. It might help when it comes time to dig deeper into it.

The first thing I notice is that we can write the source of $a_n$ as $n \log_{168}(927)$. To save typesetting later, I’m going to give the logarithm a name: let $L = \log_{168}(927)$.

The next thing I wonder is “what happens as $n$ gets large?”

Well, if the sequence continued forever, we would end up with $a_N - a_0$ getting closer and closer to $\frac{4}{3}N$ – so the sequence can only continue forever if $L = \frac{4}{3}$.

That would only be the case if $168^3 = 927^4$ – but they can’t be equal because one is even and the other odd.

Therefore, the sequence doesn’t continue forever.

It does go on a long way, though.

It turns out that $L$ is very close to $\frac{4}{3}$ – if you use a calculator, it’s 1.3333336442, which is off by one part in about four million.

The sources for the first few terms look like this:

$n$ $n L$ $a_n$
1 1.3333336442309476 1
2 2.666667288461895 3
3 4.000000932692843 4
4 5.33333457692379 5
5 6.666668221154739 6
6 8.000001865385686 8
7 9.333335509616633 9
8 10.66666915384758 11
9 12.000002798078528 12

… as you can see, the decimal parts of the sources change very little between $a_k$ and $a_{k+3}$. So where does it break down?

It’s going to break down when the “.3333…” part reaches .5 – that’s the first time one of the numbers will round to a different thing.

How long will that take? The difference between the sources $a_5$ and $a_2$ is $3L$, or 4.000000932692843 – we’re interested in the decimal part, which is $9.3 \times 10^{-7}$ – three terms increases the decimal part by a little more than a millionth.

We need to bump “a bit more than a third” to “anything more than a half”, so we want an increase of something on the order of a sixth. If three terms increases the decimal part by a millionth, we will want something on the order of half a million terms.

Indeed, if we work out $\frac{1}{6} \div \br{L - 4/3}$, we get 536,082. We want a term number that’s one more than a multiple of 3, so let’s try 536,083: according to the Wolf, that’s plausible – and the term three before it rounds down.

So, I think $b_{536082}$ is the first element in the sequence that doesn’t follow the pattern. That’s quite a long way in!

(Interestingly – and perhaps predictably – this is linked to the continued fraction of $L$, which is $[1; 2, 1, 357387, \dots]$. That $536082 \div 357387 \approx \frac{3}{2}$ is not a coincidence, but I’ll leave the explanation as an exercise.)