6 Nov
2011
6 Nov
'11
7:29 p.m.
OEIS claims also a(n+1) = number of ways of writing n as a sum of powers of 2, each power being used at most twice (the number of hyperbinary representations of n) [Carlitz; Lind] If so, it seems to me this yields a fast algorithm for evaluating a(n), "fast" meaning in O(log(n)) steps: You keep incrementing k, the maximum power of 2, each time keeping track of the #reps of m=(n modulo 2^(k+1)) and of m+2^(k+1). That's only two counts to keep track of. This algorithm enables us to say what is the nth rational number in O(log(n)) steps. Question: is there any fast way to go in the other direction: given a rational, what is its position in the order?