Is there a function to *reverse* a number

229 Views Asked by At

Is there a function say $$f(x)$$

which can Reverse constant number ?


For example if we have $$x=22314$$

then $$f(x)=41322$$


Please tell me if it is possible. I suspect the use of $floor$ or $ceil$ kind of functions ...

This may help : This is called the Number extractor function as it extracts the $n^{\text{th}}$ digit from a number $a$:

$$f(n) = \left \lfloor 10^{n-1} \cdot a \right \rfloor - 10 \left \lfloor 10^{n-2} \cdot a \right \rfloor , n \in \mathbb{Z^{+}}$$

For example if $a=\pi$ then $f(1)=3 , \space f(2)=1 , \space f(3)=4 ...$

Or if $a=32=32.\bar{00}$ then $f(1)=3 , f(2) =2 , f(3)=0 , f(4) =0 ...$


Thanks!

1

There are 1 best solutions below

1
On BEST ANSWER

Let $N(a)$ be the number of digits in $a$.

$$r(a)=10^{N(a)}\sum_{n=0}^{N(a)-1} 10^{-n-1}\left(\lfloor 10^{-n}a\rfloor - 10\left\lfloor 10^{-n-1}a\right\rfloor\right).$$

You may be able to manipulate this into a closed form should one exist, e.g. check out some properties of the floor function here. However, I doubt this is possible.

Update The generalisation of Mobius inversion could help towards a closed form.