A fascinating number chain.
Take a two digit number $10x+y$ of which both digits are different. now add $y-x$ to this number. By repeating this process you will get a chain of numbers $45,46,48,52,49,54,53,51,47,50.$ after $50, 45$ will come and chain will repeat. from any number we will enter in this chain.
Can anyone help me to prove this?
Solution 1:
First of all, you must check that this process stays inside $\{1...99\}$. At each stage the iterated function $f$ adds a number between $0$ and $9$, so in order to have $f(x)>99$, we would need $x>90$. But for $x>90$, the units digit is always smaller, so you're always adding a negative value. Similarly, to have $f(x)<1$, we would need $x<10$, but then the units digit is always bigger, so you always add a positive value.
So, since we always stay within that finite set, we must get a repetition eventually. As soon as that happens, we'll enter a cycle. We have only to verify that the one you describe in your question is the only one. This can be checked explicitly by getting a computer to calculate $f(x)$ for $1\leq x\leq 100$:
Bigger image. Sorry about the messy graph, couldn't find good plotting software.
I somewhat doubt there's any more profound proof than that. It's a fairly arbitrary mapping as far as I can see. The fact that it will eventually repeat is something common to all mappings of a finite set to itself. Some of those mappings have $3$ cycles. Some have $18$. This one happened to have $1$. Sure, why not. Or, to put it another way, the non-trivial feature of your function is that it maps $\{1, ... 99\}$ into itself, and the cycle is just a corollary of that.
What I do find interesting is the symmetry of the above graph. It could be explained if we could prove that:
$$f(99 - x) = 99 - f(x)$$
That is, the involution $x\to99-x$ is an automorphism for this system (not sure if the word "automorphism" is actually used in this context, but if nothing else it's certainly an automorphism of the above directed graph). This is because this involution has the effect of replacing each digit in a two-digit number with $9$ minus itself, so $10x+y$ gets mapped to $10(9 - x) + (9 - y)$. So the difference between the two digits changes from $y-x$ to $(9-y)-(9-x)=x-y$, that is, it gets multiplied by $-1$. So if $x$ is a two digit number and $f(x)=x+d$, we have:
$$99-f(x)=99-(x+d)=(99-x)-d=f(99-x)$$
Solution 2:
Here are some thoughts that make it possible to understand what is going on without much computation.
First, your transformation is compatible with reduction modulo$~11$, for which it gives the operation of multiplication by$~2$, as one has $10x+y\equiv y-x\mapsto10x+y+(y-x)\equiv2(y-x)$. Since you forbade the multiples of$~11$, and $2$ happens to be a generator of the multiplicative group $(\Bbb Z/11\Bbb Z)^\times$, all values give the same repeating cycle of$~10$ nonzero congruence classes modulo$~11$, started at different points.
To understand the precise behaviour, consider a set of $10$ successive values $\{11n-10,\ldots,11n-1\}$ for a fixed $0<n<10$. The amount added to these numbers increases going from $11n-10$ up to $10n-1$, then drops (by$~10$) for $10n$ after which it increases when continuing to $11n-1$. Therefore if any number in this set maps to a number larger than any in the set, then it certainly happens to $10n-1$, and if any number in this set maps to a number smaller than any in the set, then it certainly happens to$~10n$. But the former happens whenever $10n-1+(9-(n-1))>11n-1$ which amounts to $n<5$, while the latter happens whenever $10n+(0-n)<11n-10$ which amounts to $n>5$. In particular both conditions are mutually exclusive, and one of them happens (the set "leaks" upwards or downwards) unless $n=5$. Now it is clear that for $n=5$ one obtains the only nonempty set of allowed numbers that is mapped bijectively to itself, and it is therefore the only possible final cycle.