Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.



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

share|cite|improve this question
The first and second operations there don't seem to be equivalent. 23, not .23 is the reverse of 32. There's no real formula that can do what you're asking, but one could write an _algorithm_—that is, a set of steps—to do so. It's also possible to write a formula for numbers of a specific length. For example, if $x$ only has two digits, $F_{10}(x) = 10(x \mod 10) + \left\lfloor\frac x{10}\right\rfloor$ – ahruss Mar 7 '13 at 4:59
As for the reverse of an irrational number, you're right that you do get an infinitely large number, but you're wrong that that's not infinity. By definition, that number is the same as infinity. – ahruss Mar 7 '13 at 5:00
@ahruss That's...not right. You can't define the reversal of an irrational number precisely because there is no real number that does not terminate to the left. 'Infinity' is not a number. – Potato Mar 7 '13 at 5:20
You can't sensibly write $F(F(x))=x$ if you can't make sense of $F(x)$. You can't use $F(F(x))=x$ as evidence that $F(x)$ makes sense. – Gerry Myerson Mar 7 '13 at 5:32
That like saying why can't I use $f(x)=1/x$ on $x=0$ because $f(f(0))=0$ is perfectly fine. Are you saying that dividing 1 by zero is okay? How can you do something twice if you can't even do it once? – Fixed Point Mar 7 '13 at 8:45
up vote 5 down vote accepted

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.

share|cite|improve this answer
Thank you for the function, and thank you all for the explanations! – aboveyou00 Mar 7 '13 at 12:28

Applying the procedure to a real irrational (even if that irrational is between zero and one) does not produce an integer. There is no such thing as an infinitely large integer. Applying the procedure to an irrational produces something that has no properties at all, until you can produce a coherent theory of strings of digits infinite to the left. But that first step is a doozy --- trying to produce a coherent theory of such strings.

share|cite|improve this answer
Can't the coherent theory just be "These are the real numbers reflected across the decimal point"? Addition and multiplication follow the rules of $F(a) + F(b) = F(a+b), F(a) F(b) = F(ab)$. Unless, what you mean, is that it's not coherent to the real numbers. – Calvin Lin Mar 7 '13 at 4:57
Strings of base-$b$ digits infinite to the left and finite to the right can be considered as $b$-adic numbers. They work best when $b$ is prime, but can still be defined if it isn't. – Robert Israel Mar 7 '13 at 5:16
@RobertIsrael What do you mean? – aboveyou00 Mar 7 '13 at 5:27
@Calvin, of course, you're right. But then you just have the real numbers, written backwards. People who propose strings infinite to the left generally think they are something new, not just a way to write the same old thing we already had. – Gerry Myerson Mar 7 '13 at 5:28
aboveyouoo, if you do a websearch for "p-adic numbers" you'll see what Robert is talking about. But it doesn't interact in any nice way with the reversal that's infinite to the right. – Gerry Myerson Mar 7 '13 at 5:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.