Hacker News new | ask | show | jobs
by ccalloway 1577 days ago
2 is roughly 10^(0.3)

Suppose that you take powers of 2, and then divide by 10 if it's greater than 10.

    2^7 ~= (10^(0.3))^7 = 10^2.1 --> 10^(2.1 mod 1) = 10^0.1
    2^4 ~= (10^(0.3))^4 = 10^1.2 --> 10^(1.2 mod 1) = 10^0.2
    2^1 ~= (10^(0.3))^1 = 10^0.3 --> 10^(0.3 mod 1) = 10^0.3
    2^8 ~= (10^(0.3))^8 = 10^2.4 --> 10^(2.4 mod 1) = 10^0.4
    ...
where the arrow denotes dividing out as many powers of 10 as you can.

It seems surprising that the numbers are in the right order but of course it's not. Doing lexicographic sort and then dividing out powers of 10 is the same as dividing out powers of 10 and then just doing a numeric sort. So the lex sort is a sort of (accidental) legerdemain here.

The powers to which you raise 2 are given by the inverses of 1, 2, 3 etc mod 10. In other words you're raising (10^0.3) to a power k, chosen so that the remainder 0.3 * k mod 1 is the multiple of 0.1 that you need.

    1 / 3 mod 10 = 7
    2 / 3 mod 10 = 4
    3 / 3 mod 10 = 1
    4 / 3 mod 10 = 8
    ...
They are also given by multiples of 7 mod 3.