Does this generalize? Like taking 2^0, 2^1, ..., 2^99 -> lexicographical sort -> putting the decimal point, and then comparing to 10^0.00, 10^0.01, ...?
2^(10/3) ~= 10
so 2^(100/30) ~= 100
so it should work.And I think this trick should work for powers of any a in any base b where there is a k such that
a^(b/k) ~= b
aka k ~= b * log a / log b
a ~= e^ (k * (log_e b)/ b)
and if b is the base of your logarithm, this simplifies to k ~= b * log a
a = b^(k/b)
10 * log 2 = 3.0103
10 * log 5 = 6.9897
, so 5 works too.... >>> approx = lambda a: sorted( [float(scale(str(a**k)[:3])) for k in range(0,10)])
>>> [10**(k/10.0) for k in range(0,10)]
[1.0, 1.25, 1.58, 1.99, 2.51, 3.16, 3.98, 5.01, 6.30, 7.94]
>>> approx(2)
[1.0, 1.28, 1.60, 2.00, 2.56, 3.20, 4.00, 5.12, 6.40, 8.00]
>>> approx(5)
[1.0, 1.25, 1.56, 1.95, 2.50, 3.12, 3.90, 5.00, 6.25, 7.81]
Is it a coincidence that this works for 2 and 5 in base 10, while 2*5 = 10 ?