sarvesh.
Blogs

A sequence that keeps almost doubling

At index eight there are 25 words. At index nine there are 49. One word has a single continuation, and each of the other 24 has two. The same near-doubling recurs at every power of two. Yet the ratio between consecutive counts never settles.

Two new bits at a time

Peter Kagey asks us to write a binary word in which every odd-length prefix balances. Ignore its middle bit. The parts on either side must contain the same number of ones. A word and its bitwise complement count as one, so choose the representative starting with 1. Write a(n) for the count at length 2n − 1. The first nine terms are 1, 2, 3, 4, 7, 11, 17, 25 and 49. OEIS A297789

Number the bits from zero. Subtract the balance equations for adjacent odd prefixes. The sum of the new bits equals the sum of two bits already in the word:

x2k−1 + x2k = xk−1 + xk.

At the first extension the middle bit is free and the last bit repeats the first. Thereafter equal parents force the new pair. Unequal parents allow 01 or 10. At a power of two, equality of the parents propagates backwards by halving the index until it reaches the first two bits. If those agree, the word consists entirely of ones. Kagey observed the resulting identity and Li-yao Xia proved it in 2018. Xia’s proof

a(2j + 1) = 2a(2j) − 1   (j ≥ 1).

The dyadic counts increase without bound. Their consecutive ratios approach two. Any limit of the full sequence of ratios would therefore have to equal two.

Six possibilities out of eight

Group stages k, k + 1 and 2k + 1. The last stage reads its parents from the boundary of the two earlier pairs. Even when both earlier pairs are free, two of their four orders make this boundary equal, forcing the final pair.

First pairSecond pairBoundaryChoices at last stage
0101102
0110111
1001001
1010012
The four rows allow six continuations in total. If one earlier pair is forced, the total is at most four.

In a word with 8t stages, first fix the choices through stage 2t. Use each odd k from 2t + 1 to 4t − 1 as the start of a triple. There are t disjoint triples, and the early choices already determine the parents at their first two stages. The remaining 3t stages each contribute at most two possibilities. Multiplication gives

a(8t + 1) ≤ 22t 6t 23t = 192t.

If the ratios approached two, eventually each would exceed 1.99. Eight successive steps would then multiply the count by more than 1.998, which exceeds 192. Repeating this over enough blocks contradicts the bound. The exact asymptotic size of the counts remains a separate question.

The word left over

For every n > 4 the count is odd. In each nonconstant word, choose the earliest stage beyond n/2 with unequal parents. The paper proves that such a stage exists, including at powers of two. Swap its two children. Both lie beyond the last parent position, so a second application chooses exactly the same stage and reverses the swap.

101101101↔101101110
At n = 5 the swap is at stage four. The seven words form three pairs and the unpaired all-ones word.

The argument works at every larger index. At n = 4 the count is four, so the threshold is sharp.

Read the paper · Download PDF · Lean proofs on GitHub

Research conducted using OpenAI Codex, with formal proofs verified in Lean.