Number Theory – Formula to Reverse Digits

elementary-number-theoryirrational-numbers

Is there a formula that can be used to reverse the digits in a number, given a certain base b? E.G.,

$$F_{10}(32) = .23$$
$$F_{10}(123.456) = 654.321$$

If not, how can you write this out to show what you mean?

Also: what do you call a number that results from applying an irrational number to this formula/procedure? It is an integer (albeit infinitely large) which means it is no longer irrational (n/1 = n). It is also not ∞, unless I am mistaken – it is still it's own number, with its own properties, and you can compare it to other numbers and get back the original irrational number by applying the procedure again.

Thanks,

Brandon

P.S. I'm not really sure what tags to use, I apologize.

Best Answer

So, you are looking for a way to flip the number about the decimal point in whatever base. Here is the function which will do it

$$f(x)=\sum_{n=0}^{\infty} 10^{-n-1} \left(\left\lfloor\frac{x}{10^n}\right\rfloor \mod 10\right)+\sum_{n=1}^{\infty} 10^{n-1} \left(\left\lfloor 10^nx\right\rfloor \mod 10\right)$$

which is just a compact form of an algorithm. This is basically starting from the decimal point, first going to the left the digits are flipped. Then the second sum starts from the decimal point and going to the right flips the digits.

For whatever base, just replace all of the 10's with whatever base you want. This will work fine when the number (in whatever base) has a terminated expansion on both sides of the decimal point meaning both sums are finite. For irrational numbers for example, the second sum won't converge and the function isn't defined at all so don't use this to flip the digits of $\sqrt{2}$ because it can't be done. Another way to say that is the algorithm won't terminate in finite time (and we don't have infinite memory) because we don't know the "last" digit of $\sqrt{2}$ in base 10 for example. And even for some rational numbers this function doesn't make sense. For example you can't flip the decimal expansion of 1/3 in base 10 because it doesn't terminate in base 10.

Related Question