5

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.

  • 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 07 '13 at 04: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 07 '13 at 05:00
  • @ahruss: I say 32 -> .23 because if 32 went to 23, then the domain would be limited to integers - what would you do with 23.45? As far as the infinitely large number (it may not be an integer, I don't know) - I don't think you can count it as infinity, because Fx(Fx(n)) = n ... – leviathanbadger Mar 07 '13 at 05:20
  • 1
    @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 07 '13 at 05:20
  • 1
    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 07 '13 at 05:32
  • For example, let $G(x)=\infty/x$. Formally, $G(G(x))=\infty/(\infty/x)=x$. But does $G(x)=\infty/x$ actually make any sense? – Gerry Myerson Mar 07 '13 at 05:35
  • I don't know quite how to write F(x), but I still know that it's just reversing the digits. If you reverse the digits twice, you get back the original number. Why can't I do it? – leviathanbadger Mar 07 '13 at 05:38
  • 1
    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 07 '13 at 08:45

3 Answers3

8

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.

Fixed Point
  • 7,909
  • 3
  • 31
  • 48
4

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.

Gerry Myerson
  • 179,216
  • 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 07 '13 at 04:57
  • 3
    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 07 '13 at 05:16
  • @RobertIsrael What do you mean? – leviathanbadger Mar 07 '13 at 05: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 07 '13 at 05: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 07 '13 at 05:30
  • (By the way, thanks for the answer!) I guess it's not an integer, but it surely isn't infinity either. Rationale: Let n = Fx(pi). Fx(n + 1) = 3.24159... You can't do this to infinity. I'm about to research it, is this what you mean by p-adic? – leviathanbadger Mar 07 '13 at 05:32
  • No.${}{}{}{}{}$ – Gerry Myerson Mar 07 '13 at 05:37
1

Sorry I am not allowed to comment yet but the function provided by the first answer is not correct, it does perform digit reversal but is missing a composite function in it's denominator which i will post later for the non recurring fractions for which it does work in terms of digit reversal, but for recurring fractions such as 1/3,1/6,1/7 this formula does not work and requires the author to make some more alterations in addition to that composite function.

I can provide a formula that will work for all integers in all number bases, however I am yet to formulate an extension for this to $Q\backslash\,Z$.

The following will work for natural numbers in any base representation (b>1), but there are some pretty serious things i need to consider before moving to non integer fractions and eventually irrationals and resources on the subject are hard for me to find,but if somebody has one that works, please, do tell as it will take me a while on my own:

We start again with the Kronecker delta:

$$\delta \left( x,y \right) =\cases{1&$x=y$\cr 0&$x\neq y$\cr}\quad\qquad\quad\qquad\quad\qquad\quad\qquad\quad\qquad\quad\qquad\quad\qquad\quad\quad\quad\quad\quad\quad\quad\text{ (1)}$$

Which allows us to express the digits of a number 'a' in base 'b' in a computable integer sequence, in that we already know the exact length of the sequence which is of course the number of digits in total. The expression for this computation is:

$$d_{{n}} \left( a,b \right) =\sum _{k=1}^{ \Bigl\lfloor {\frac { \ln \left( a \right) }{\ln \left( b \right) }}\Bigr\rfloor +1} \left( \delta \left( n,k \right) -b\delta \left( n,k+1 \right) \right) \Bigl\lfloor{a{b}^{k- {\Bigl\lfloor\frac {\ln \left( a\right) }{\ln \left( b \right) }\Bigr\rfloor} -1}} \Bigr\rfloor \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad$$

For example, $a=12345$ in base $b=10:$ will, purely coincidentally of course, evaluate to the arithmetic progression with initial value of 1 and d=1 of length 5: $$\left\{ d_{{1}} \left( 12345,10 \right) ,d_{{2}} \left( 12345,10 \right) ,d_{{3}} \left( 12345,10 \right) ,d_{{4}} \left( 12345,10 \right) ,d_{{5}} \left( 12345,10 \right) \right\} = \left\{ 1,2,3,4, 5 \right\} $$

But this(2) will compute the $n^{th}$ digit for the number in any base $b>1$, and thus these values correspond to the coefficients of the b-adic expansion * of the number thus we have as follows:

$$\mathcal{P} \left( a,b \right) =\sum _{n=0}^{ \Bigl\lfloor { \frac {\ln \left( a \right) }{\ln \left( b \right) }} \Bigr\rfloor +1}d_{ {n}} \left( a,b \right) {b}^{n}\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\text{ (3)} $$

And from this we can perform digit reversal as follows in any base as far as I can guess, although don't quote me on it because when I noticed this i thought it was too silly to share so i haven't checked other values of b:

$${\frac {\mathcal{P} \left( N,b \right) }{b}}$$

$$\frac{\mathcal{P} \left( 12345,10 \right)}{10} =54321$$

$$\frac{\mathcal{P} \left( 13454345345,10 \right)}{10} =54354345431$$

$$\frac{\mathcal{P} \left( 842622684442,10 \right)}{10} =244486226248$$

Adam Ledger
  • 1,240