3

European Mathematical Cup 2024 (Ended yesterday and as per the rules discussion is now allowed)

Problem 1 Wiske wrote a 2024-digit positive integer on the blackboard. In each round of the game she erases the last digit of the number, let this be d, and writes down the sum of the remaining number and 2d in place of the old number. She repeats the same steps with the newly obtained number. After a certain number of rounds, Wiske found that the new number obtained was the same as the number in the last round and she stopped the game. What is the smallest possible 2024-digit integer that Wiske could have started with in this game?

My solution was the smallest multiple of $19$ greater than $10^{2023}$. Later at home I used a C program to compute the Modulo pattern and found that the answer is $100...004$.

The way I got my answer is by realizing that the only case where Old Number $=$ New Number $+\ 2d$ is when the Old Number is 19 as $19=1+2*9$. I then computed the numbers that result in 19 and found they are all multiples of 19, and then I tested a few of those and they were also all multiples of 19 and so I came to the half guessed conclusion that it must be a sequence of multiples of 19.

I tested this fact for some numbers with a C program and found it to be true, but $10^{2023}$ is just too large to check. And so I am wondering if my solution is even true, and if it is why is it true?

Bill Dubuque
  • 282,220
Ilikemath
  • 358
  • 1
    If $x_n$ is the old number and $x_{n+1}$ the new number, you want to show $2x_n \equiv x_{n+1} \pmod{19}$ and so you can only have $x_n=x_{n+1}$ when $x_0\equiv x_n \pmod {19}$. You also want to show that $x_n$ is eventually "small" in the sense that $x_{n+1} \le \frac {x_n}{10}+18$ so if $x_n>20$ then $x_{n+1}< x_n$ – Henry Dec 23 '24 at 15:19
  • It's essentially applying a common divisibility test by $19$, viz. $$,19\mid \color{#0a0}{10}b+a\iff 19\mid b+\color{#c00}2a,\ \ {\rm by}\ \ \color{#0a0}{10}^{-1}\equiv \color{#c00}2!!!\pmod{!19}\qquad $$ cf, here in the dupe. $\ \ $ – Bill Dubuque Dec 23 '24 at 18:41
  • Your instincts are spot on: $10a+d=a+2d\iff 9a=d$ which if they are digits implies $a=1;d=9$ is the only possibility. The rest is a matter of convincing ourselves $10a+d$ and $a+2d$ are either always both multiples of $19$ or neither multiples of $19$. This is clear if we consider $\mod 19$ that $10$ and and $2$ are multiple inverses. $10a+d\equiv 0\iff 2(10a+d)\equiv 2\cdot 0\iff a+2d \equiv 0\pmod{19}$. And that's pretty much it. You just have to show that we can't "avoid" 19 by going into an infinite loop as $10a+d\to a+2d$ is nearly always decreasing. – fleablood Dec 23 '24 at 18:59
  • @BillDubuque Apologies for posting a duplicate, however there was no way for me to know it was a duplicate as the "duped" post itself is pretty much the answer to my question. – Ilikemath Dec 23 '24 at 21:01

2 Answers2

4

This is not by any means an elegant solution, but it's the first one I thought of and probably the one that requires the least thinking.

Let $n_0$ be the initial $2024$-digit number and $n_k$ be the number after the operation has been applied $k$ times. Some things to note:

$$ \begin{align*} d &= n_k \textrm{ mod } 10 \\ \textrm{Remaining Number After Erasure} &= \left\lfloor\frac{n_k}{10}\right\rfloor \\ a \textrm{ mod } b &= a-b\left\lfloor\frac{a}{b}\right\rfloor \end{align*} $$

With this in mind, we can say that: $$ \begin{align} n_{k+1} &= \textrm{Remaining Number After Erasure} + 2d \\ &= \left\lfloor\frac{n_k}{10}\right\rfloor + 2(n_k \textrm{ mod } 10) \\ &= \left\lfloor\frac{n_k}{10}\right\rfloor + 2n_k - 20\left\lfloor\frac{n_k} {10}\right\rfloor \\ &= 2n_k - 19\left\lfloor\frac{n_k}{10}\right\rfloor \end{align} $$ First, we want to show that $19$ is the only valid solution for $n_{k+1}=n_k$. Setting $n_{k+1}=n_k$, we have: $$ \begin{align} n_k - 19\left\lfloor\frac{n_k}{10}\right\rfloor &= 0 \\ \frac{n_k}{19} &= \left\lfloor\frac{n_k}{10}\right\rfloor \end{align} $$ For which it's pretty clear that $n_k=19$ is the only solution.

Now let's show that this operation will only produce a multiple of 19 if the input is also a multiple of $19$. If we instead set $n_{k+1}=19m$ for some positive integer $m$ we have: $$ \begin{align} 19\left(m+\left\lfloor\frac{n_k}{10}\right\rfloor\right) &= 2n_k \\ m+\left\lfloor\frac{n_k}{10}\right\rfloor &= \frac{2n_k}{19} \\ \end{align} $$ Where we see that $19 \mid 2n_k$ and so $19 \mid n_k$.

Now we have to show $n_{k+1} < n_k$ for all $19 \mid n_k$ and $n_k > 19$. This will imply that every multiple of $19$, when repeatedly plugged into this operation, will eventually reach $19$ itself. Set $n_k=19m$ where $m > 1$: \begin{align} n_{k+1} &= 38m - 19\left\lfloor\frac{19m}{10}\right\rfloor \\ &= 38m - 19\left\lfloor m+\frac{9m}{10}\right\rfloor \\ &= 19m - 19\left\lfloor\frac{9m}{10}\right\rfloor < n_k \end{align}

So you are correct in that $n_0$ must be the smallest multiple of $19$ greater than $10^{2023}$. For actually finding that value, we can use the following rule of modular arithmetic:

If $a \equiv b \pmod{\phi(m)}$ and $\gcd(n, m)=1$ then $n^a \equiv n^b \pmod{m}.$

($\phi(m)$ is Euler's Totient Function)

Since $\phi(19)=18$ and $2023 \equiv 7 \pmod{18}$, we have $10^{2023} \equiv 10^7 \equiv 15 \pmod{19}$. Finding $10^7 \textrm { mod } 19$ is a bit annoying, but very doable. And so, to get the smallest multiple of $19$, you just have to add $4$ to get $10^{2023} + 4$.

  • 1
    FYI Nothing wrong with your solution, but the writeup could be assisted by adding some words to describe you're wanting to achieve at each step, instead of having the reader infer it from contextual clues. IE Step 1: Showing that the final number can only be 19. Step 2: Showing that all of the numbers are multiples of 19. Step 3: Showing that the sequence is strictly decreasing – Calvin Lin Dec 23 '24 at 16:01
  • @CalvinLin good point, I added a few words before each major step. Hope this is clear enough. – mediocrevegetable1 Dec 23 '24 at 16:11
  • Please strive not to post more (dupe) answers to dupes of FAQs. This is enforced site policy, see here. – Bill Dubuque Dec 23 '24 at 18:37
  • 3
    @BillDubuque probably just a copy-pasted comment not specific to this, but I think this answer is pretty alright; even aside from posting without the knowledge this was an already-asked question, I don't think the question itself is a low quality post, which your link talks about (it's definitely a dupe but otherwise the poster provides context, personal findings and effort), and my solution method is not found in the dupe as far as I know. – mediocrevegetable1 Dec 23 '24 at 18:46
2

Let's denote by "$\operatorname{reduce}$" the function that maps a natural number $n$ to $n'+2d$, where $n'$ is the number $n$ with the last digit erased, and $d$ is the last digit of $n$.

Now, obviously we have $10n'+d \equiv n \pmod{19}$, and from this it follows by multiplying by $2$ that $n'+2d \equiv 2n \pmod{19}$. So we conclude that $$\operatorname{reduce}(n) \equiv 2n \pmod{19}.$$ In other words, the function $\operatorname{reduce}$ maps multiples of $19$ to multiples of $19$, and non-multiples of $19$ to non-multiples of $19$. I think this more or less shows what you want (you still have to show that every multiple of $19$ eventually gets you down to $19$ itself, but I'm assuming this will follow by taking some easy bounds).

R.P.
  • 1,546
  • Please strive not to post more (dupe) answers to dupes of FAQs. This is enforced site policy, see here. – Bill Dubuque Dec 23 '24 at 18:36
  • 2
    @BillDubuque When I posted my answer, it hadn't been marked and/or closed as duplicate, so there was no way for me to know. (Even now this question doesn't strike me as duplicate, exactly, it's just that the idea from the other post can be used to solve this one.) – R.P. Dec 23 '24 at 19:47