Tuesday, October 28, 2025

987654321 / 123456789


I just lately noticed somebody put up [1] that 987654321/123456789 could be very practically 8, particularly 8.0000000729.

I puzzled whether or not there’s something distinct about base 10 on this. For instance, would the ratio of 54321six and 12345six be near an integer? The ratio is 4.00268, which is fairly near 4.

What a few bigger base? Let’s strive base 16. The expression

0xFEDCBA987654321 / 0x123456789ABCDEF

in Python returns 14. The precise ratio is just not 14, however it’s as near 14 as a regular floating level quantity might be.

For a base b, let denom(b) to be the quantity fashioned by concatenating all of the digits in ascending order and let num(b) be the quantity fashioned by concatenating all of the digits in descending order.

Then for b > 2 we now have

frac{text{num}(b)}{text{denom}(b)} = b - 2 + frac{b-1}{text{denom}(b)}

The next Python code demonstrates [2] that that is true for b as much as 1000.

num = lambda b: sum([k*b**(k-1) for k in range(1, b)])
denom = lambda b: sum([(b-k)*b**(k-1) for k in range(1, b)])

for b in vary(3, 1001):
    n, d = num(b), denom(b)
    assert(n // d == b-2)
    assert(n % d == b-1)

So for any base the ratio is almost an integer, specifically b − 2, and the fractional half is roughly 1/bb−2.

When b = 16, as within the instance above, the result’s roughly

14 + 16−14 = 8 + 4 + 2 + 2−56

which might take 60 bits to symbolize precisely, however a floating level fraction solely has 53 bits. That’s why our calculation returned precisely 14 with no fractional half.

 

[1] I noticed @ColinTheMathmo put up it on Mastodon. He mentioned he noticed it on Fermat’s Library someplace. I assume it’s a really outdated commentary and that the evaluation I did above has been carried out many occasions earlier than.

[2] Why embody a script moderately than a proof? One motive is that the proof is straight-forward however tedious and the script is compact.

A extra normal motive that I give computational demonstrations of theorems is that applications are complementary to proofs. Packages and proofs are each topic to bugs, however they’re not prone to have the identical bugs. And since applications made particulars express by necessity, a program would possibly fill in gaps that aren’t sufficiently spelled out in a proof.

Related Articles

Latest Articles