1

A friend of mine taught me a number game.

Supposting that $a_na_{n-1}\cdots a_1$, which satisfies $a_n\gt a_1$, is a natural $n$-digit number with decimal representation, let's consider the following operations :

1. $a_na_{n-1}\cdots a_1-a_1a_2\cdots a_n=b_nb_{n-1}\cdots b_1.$

2. $b_nb_{n-1}\cdots b_1+b_1b_2\cdots b_n.$

Let $N(a_na_{n-1}\cdots a_1)$ be the number gotten by these operations.

Remark : Suppose that $0$ is added in the case of cancellation of significant digits by the step 1.

Examples :

$4312-2134=2178\rightarrow 2178+8712=10890$. Hence, we get $N(4312)=10890.$

$514-415=099\rightarrow 099+990=1089$. Hence, we get $N(514)=1089.$

Then, here is my question.

Question : Find all possible $N(a_na_{n-1}\cdots a_1)$ for each $n\ge 4$.

Motivation : A friend of mine taught me that it is known that only $99$ can be gotten for $n=2$ and that only $1089$ can be gotten for $n=3$. These got me interested in the above question. My search tells me that only $10890, 10989, 9999$ seems to be gotten for $n=4$. Thought I've looked for a way to solve without using computer, I'm facing difficulty. Can anyone help?

mathlove
  • 139,939
  • It is sufficient to check numbers with only 0 and 1 as their digits as the final answer depends only on sign of $a_j$-$a_{n+1-j}$ for all $j$. – user96614 Oct 07 '13 at 19:53
  • @user96614: I want you to prove what you said because I'm not sure if what you said is true. – mathlove Oct 08 '13 at 14:24
  • Define $r_j=a_{n+1-j},s_j=sign(a_j-r_j)$. Define carry flag $c_j=1$ if $\exists k<j$ such that $s_k=-1$ and $s_i=0$ for all $i$ such that $k<i<j$ and $c_j=0$ otherwise. Similarly, define $d_j=1$ if $\exists k>j$ such that $s_k=1$ and $s_i=0$ for all $i$ such that $j<i<k$ and $d_j=0$ otherwise. Clearly, $c_j=d_{n+1-j}$. Now, $b_j=(a_j-r_j-c_j)\bmod 10=(s_j-c_j)\bmod 10+a_j-r_j-s_j$ and $b_{n+1-j}=(r_j-a_j-c_{n+1-j})\bmod 10=(-s_j-d_j)\bmod 10+r_j-a_j+s_j$. In the answer, $j$th digit (before carrying) is $b_j+b_{n+1-j}=(s_j-c_j)\bmod 10+(-s_j-d_j)\bmod 10$ which depends only on $s_j \forall j$. – user96614 Oct 08 '13 at 14:56
  • Oh! nice. I understood what you mean. Thanks! – mathlove Oct 08 '13 at 15:04

0 Answers0