Written by Colin+ in ask uncle colin, ninja maths.

*Ask Uncle Colin* is a chance to ask your burning, possibly embarrassing, maths questions -- and to show off your skills at coming up with clever acronyms. Send your questions to colin@flyingcoloursmaths.co.uk and Uncle Colin will do what he can.

Dear Uncle Colin

Somebody told me that the sequences $\left \lfloor \frac {2n}{\ln(2)} \right \rfloor$ and $\left \lceil \frac{2}{2^{\frac 1n}-1} \right \rceil$ were equal up to the 777,451,915,729,368th term, and I shivered in ecstasy. Is there something wrong with me?

-- Sequences Considered Harmful When Agreeing Really Zealously

Hi, SCHWARZ -- well, different strokes for different folks! There's nothing wrong with getting an ecstatic frisson from a nice bit of maths. Some mathematicians get that all the time!

Now, as for the sequence, it's A078608 from the OEIS. Why do they agree so well?

The first sequence is almost a linear progression, although the floor function means it's not a straight line -- each number is generally 3 more than the previous one, but occasionally 2.

The second, on the face of it, has little in common with the first. The variable's on the bottom, for heaven's sake! However, there's a neat trick we can employ1. $2^\frac1n = e^{\frac 1n \ln(2)}$, which means the second sequence is also:

$\left \lceil \frac{2}{e^{\frac 1n \ln(2)} - 1} \right \rceil$.

$e^{\text{stuff}}$? We know an expansion for that! It's $1 + \text{stuff} + \frac 12 \text{stuff}^2 + ...$. Here, the 'stuff' is $\frac 1n \ln(2)$, and we're going to take the 1 away in the end. We're left with:

$\left \lceil \frac{2}{\frac 1n \ln(2) + \frac 1{2n^2} (\ln(2))^2 + \frac{1}{6n^3}(\ln(2))^3 + ...} \right \rceil$.

Multiply top and bottom through by $n$:

$\left \lceil \frac{2n}{\ln(2) + \frac 1{2n} (\ln(2))^2 + \frac{1}{6n^2}(\ln(2))^3 + ...} \right \rceil$.

As $n$ gets larger, the second (and subsequent) terms on the bottom get very small -- in fact, if we rewrite it Mathematical Ninja-style as:

$\left \lceil \frac{2}{\ln(2) \left[ 1 + \frac 1{2n} (\ln(2)) + \frac{1}{6n^2}(\ln(2))^2 + ...\right]} \right \rceil$,

he'd estimate the proportional error as $\frac 1{2n} (\ln(2))$, which is less than 1% by the time $n=35$ or so. The two sequences are very close together -- in fact, if you 'turn them continuous' and plot them on Desmos, you get two graphs that differ by almost exactly 1.

The question, then, isn't "why do they agree so well", by "why do they ever differ?" A hint comes from the fact that $\frac{2\times 777,451,915,729,368}{\ln(2)} \approx 2243252046704766.999999999999999996$ --

very nearly an integer (an absolute difference of $4\times 10^{-17}$ and a relative difference of $2\times 10^{-32}$. The Ninja's relative error is around $3\times10^{-16}$ there, enough to push the two sequences into different numbers.

I think the two sequences differ whenever the Ninja's error is bigger than the shortfall between the almost-linear sequence and an integer; a determined mathematician would look for continued fraction approximations to $\frac{2}{\ln(2)}$ and check those!

-- Uncle Colin

* Edited 2015-10-14 to fix LaTeX.

- isn't there always? [↩]