Solving the equation: $ f ( n ) = \left \lfloor \frac n 2 \right \rfloor $

127 Views Asked by At

Let $ n $ ne a positive integer and $ n = \overline { a _ 1 a _ 2 \dots a _ { m - 1 } a _ n } $. Consider the function $ f ( n ) = \overline{ a _ m a _ { m - 1 } \dots a _ 2 a _ 1 } $. For example, $ f ( 123 ) = 321 $ and $ f ( 100 ) = 1 $. Find all the positive integers $ n $ such that $$ f ( n ) = \left \lfloor \frac n 2 \right \rfloor \text . $$

My work so far:

I found one such number. $ n = 73 $. $$ f ( 73 ) = 37 $$ $$ \left \lfloor \frac { 73 } 2 \right \rfloor = \lfloor 37.5 \rfloor = 37 $$

1

There are 1 best solutions below

0
On BEST ANSWER

We show that there is no solution. Assume that $ n $ is an $ m $-digit positive integer, and therefore of the form $$ n = \sum _ { i = 1 } ^ m 10 ^ { m - i } a _ i \text , $$ where $ a _ i \in \{ 0 , \dots , 9 \} $ for all $ i \in \{ 1 , \dots , m \} $, and $ a _ 1 \ne 0 $. Then we have $$ f ( n ) = \sum _ { i = 1 } ^ m 10 ^ { i - 1 } a _ i $$ and $$ \left \lfloor \frac n 2 \right \rfloor = \frac 1 2 \left ( \sum _ { i = 1 } ^ m 10 ^ { m - i } a _ i - b _ 0 \right ) \text , $$ where $ b _ 0 = n \bmod 2 = a _ m \bmod 2 \in \{ 0 , 1 \} $. Hence, the equation $ f ( n ) = \left \lfloor \frac n 2 \right \rfloor $ can be written as $$ 2 \sum _ { i = 1 } ^ m 10 ^ { i - 1 } a _ i = \sum _ { i = 1 } ^ m 10 ^ { m - i } a _ i - b _ 0 \text , $$ or equivalently $$ \sum _ { i = 1 } ^ m 10 ^ { i - 1 } ( 2 a _ i - a _ { m - i + 1 } ) + b _ 0 = 0 \text . $$ Define $ b _ j = \sum _ { i = 1 } ^ j 10 ^ { i - 1 } ( 2 a _ i - a _ { m - i + 1 } ) + b _ 0 $ for all $ j \in \{ 1 , \dots , m \} $. Considering the above equation modulo $ 10 ^ j $, we can see that $ b _ j \equiv 0 \pmod { 10 ^ j } $ for all $ j \in \{ 1 , \dots , m \} $. We use induction on $ j $ to show that $ b _ j \in \{ 0 , 10 ^ j \} $ for all $ j \in \{ 0 , \dots , m \} $. The base case $ j = 0 $ is already established. For the induction step, note that $ - 9 \le 2 a _ { j + 1 } - a _ { m - j } \le 18 $, and thus by the induction hypothesis $$ b _ { j + 1 } = 10 ^ j ( 2 a _ { j + 1 } - a _ { m - j } ) + b _ j \text ; $$ $$ \therefore - 10 ^ { j + 1 } < - 9 \times 10 ^ j + 0 \le b _ { j + 1 } \le 18 \times 10 ^ j + 10 ^ j < 2 \times 10 ^ { j + 1 } \text . $$ As $ b _ { j + 1 } \equiv 0 \pmod { 10 ^ { j + 1 } } $, the only options are $ 0 $ and $ 10 ^ { j + 1 } $, and the induction is complete. Now, this means that for any $ j \in \{ 1 , \dots , m \} $, $$ 2 a _ j - a _ { m - j + 1 } = \frac { b _ j - b _ { j - 1 } } { 10 ^ { j - 1 } } \in \{ - 1 , 0 , 9 , 10 \} \text . $$ Taking the above relation for $ j = i $ and $ j = m - i + 1 $ for any $ i \in \{ 1 , \dots , m \} $, we get a system of two linear equations with two variables, in the form $$ \begin {cases} 2 x - y = c \\ 2 y - x = d \end {cases} $$ with $ c , d \in \{ - 1 , 0 , 9 , 10 \} $, and the additional constraint $ x , y \in \{ 0 , \dots , 9 \} $. The solutions of the system of equations are $ x = \frac { 2 c + d } 3 $ and $ y = \frac { c + 2 d } 3 $, and examining all the cases, one can see that the only cases where the additional constraint is satisfied is when one of the following occurs:

  1. $ c = d = 0 $, in which case $ x = y = 0 $;
  2. $ c = 0 $ and $ d = 9 $, in which case $ x = 3 $ and $ y = 6 $;
  3. $ c = 9 $ and $ d = 0 $, in which case $ x = 6 $ and $ y = 3 $;
  4. $ c = d = 9 $, in which case $ x = y = 9 $.

Now, let's first show that non of the $ a _ i $ can be $ 3 $ or $ 9 $. This can be easily understood in terms of the long division algorithm, that it taught in elementary school: when dividing $ n $ by $ 2 $, starting from the left-most digit $ a _ 1 $, as long as we're only dealing with $ 0 $'s and $ 6 $'s, we get $ 0 $'s and $ 3 $'s; but the first instance of a digit being $ 3 $ or $ 9 $, results in a digit $ 1 $ or $ 4 $ in the quotient, which cannot occur, as the quotient must be equal to $ f ( n ) $, which has the same digits as $ n $, only in reverse order. This means that items 2, 3 and 4 above are not allowed, an therefore all the $ a _ i $ must be equal to $ 0 $, which is again impossible. Hence, the equation has no solutions.