I found this question in a random problem solving book that I was reading and wanted to know how you would solve it. I am not sure as how to go about this.
Take any positive integer $n$ with fewer than $10$ digits. Then perform the following steps:
$(a)$ Let $x$ be the number of even digits in $n$ and $y$ be the number of odd digits in $n,$ and let $z=x+y.$
$(b)$ Replace $n$ with the three digit number whose hundreds digit is $x,$ whose tens digit is $y,$ and whose units digit is $z.$ (note that some of these digits may be zero)
Repeat the two steps $2014$ times. What is the final value of $n$? How do you know?
My working:
I said let $n$ be $1324.$ $x$ will be $2$ even digits and $y$ will be two odd digits. $z$ will be $4$ since $z=x+y.$
Then for the next step I replaced $n$ with $224.$ Here now $x$ is $2$ and $y$ is $1.$ $z=x+y=3.$
If we replace $n$ again it will be $213.$ If we do this again, $x$ is $1$ and $y$ is $2.$ $z=x+y=3$ $n$ will be $123$ If we do this again $n$ will be $123.$ I think the final answer after $2014$ times will be $123.$
Is there any other way to solve this problem or a proof that we can use for this problem?