0
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ What book did you get this from? $\endgroup$
    – davidlowryduda
    Sep 18, 2014 at 0:42
  • $\begingroup$ @mixedmath I forgot the name of it, but it was from a problem solving book that had differnet topics and talked about how things can be done in other ways than the usual. $\endgroup$
    – col
    Sep 18, 2014 at 0:53

2 Answers 2

0
$\begingroup$

Let's proceed in the most naive way possible, by following our nose and no clever bits at all.

If you start with no even digits and only odd digits, then after one iteration you will get a two digit number where the two digits are the same.

  1. If they're both even, then another iteration will give the three digit number $202$. Another iteration of this gives $303$, and then $123$, and we're done.

  2. If they're both odd, then another iteration will give $22$, which then gives $202$ as above.

So we have handled starting with only odd digits. In fact, this also covers any time we are reduced to only $2$ digits. So we need to consider the cases when we never reduce to only $2$ digits.

Then after two iterations, we clearly get a three digit number whose last digit is $3$. We have three possibilities: two evens, one even and one odd, and two odds. The case of two odds is covered, as that would lead to a two digit number. Two evens yields $213 \mapsto 123$, and one even and one odd yields $123$.

So we've covered every case $\diamondsuit$. Further, we've shown that it takes at most 4 iterations (which was not clear to me when I started writing this).

$\endgroup$
1
  • $\begingroup$ Thanks. When I worked this out with my number I though it would take four iterations because it stayed at the same number. Thanks again $\endgroup$
    – col
    Sep 18, 2014 at 1:03
0
$\begingroup$

Clearly after the first step you get a number with three or fewer digits, and after the second step you get a number with three or fewer digits with the last digit being $3$ or less. There are now only a very small number of possibilities for this number, and each leads to the number $123$ in at most four more steps.

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .