If I have a function f that computes element m of a sequence of digits in base b, is it in general possible to write a function g that computes element n of the corresponding sequence in base c ?
As a contrived example, say f produces binary and g produces hexadecimal:
f(m) → 1, 0, 1, 0, 1, 0, 1, 0, ... g(n) → A, A, ...
Now say f is in base 5 and g is in base 6. The bases don’t share a common factor, which means that the number of digits required to represent a number from the source base in the target base is fractional (6⁄5). Is it possible to determine a single digit from g using only, say, the corresponding c⁄b digits from f ?
Note that starting the formula at the first element is the same as performing the standard conversion of a fractional number from b to c, but I want an arbitrary element of the target sequence, in the same way that I can retrieve an arbitrary element of the source.
I don’t think there is any easier way than successively dividing by the base and keeping the remainder. Of course dividing number represented in an arbitrary base would require a linear amount of work as well.
Lets say that f represents the number N then basically
It may not be necessary to to compute N explicitly, you could just do it implicitly in the base b.