Find the smallest positive integers $a, b$ such that...

Find the smallest positive integers $a, b$ such that:

i) $|a - b| = 3$
ii) the sum of digits of each of $a, b$ is divisible by $11$

• Have you made any attempt to solve the problem? Have you thought about what it says about the last digit of the smaller of the two numbers? And what effect carries have on the sum of the digits? Aug 9, 2015 at 3:52
• Yes,it seems threre is no such pair of numbers less than 9999... Aug 9, 2015 at 4:19
• I had hoped Sloane's A166311 had a formula, but no such luck. Aug 9, 2015 at 16:51

Notice that it does not matter whether $a$ or $b$ is larger. For the sake of finding a solution, simply say $a + 3 = b$. Now the goal is to find:

$a$ such that $a$ and $a+3$ both have a digit sum that is divisible by $11$.

Say $a$ has decimal representation $a_ka_{k-1} \cdots a_1a_0$.

$\\$

Unless $a_0 >= 7$, $a+3$ will have a digit sum that is simply $3$ greater than the digit sum of $a$.

Therefore, $a_0$ must be $7$, $8$, or $9$.

$\\$

Now, notice that with any of $7$, $8$, or $9$ as $a_0$, the difference between the digit sums of $a$ and $a+3$ will be equal. Therefore, $a_0 = 7$ since we are seeking the smallest number possible satisfying these constraints.

$\\$

Now, we want to find the smallest number $n$ such that the difference between the digit sum of $\overbrace{9 \cdots 9}^n7$ and $1$ is divisible by $11$.

Simple trial and error shows that $n = 3$. $9997$ has a digit sum of 34, and $34-1 = 33$, which is a multiple of $11$. Therefore, $a_3 = a_2 = a_1 = 9$ and $a_0 = 7$.

$\\$

Now, notice that $a_4$ cannot be $9$ as this will increase the value of $n$.

Regardless the value of $a_4$, the digit sum of $a_4a_3a_2a_1a_0$ will not be divisible by 11. Therefore, $a_5$ must be nonzero. To ensure that $a_5$ is as small as possible, we set $a_4$ as large as possible yet less than $9$. Thus, we set $a_4 = 8$.

$\\$

Since the digit sum of $a_4a_3a_2a_1a_0$ is now equal to $42$, we know that $a_5 = 2$.

$\\$

Therefore, $a = 289997$ and $b = 290000$. This satisfies both conditions.

Notice: While I am confident in the problem solving strategies used here, I am a high school student with no formal training in elementary number theory. This may not be the most elegant solution. I also would not discount the chance there could be a smaller solution satisfying the conditions.

Comments are definitely welcome! Let me know if I have done this correctly :)

EDIT: Thanks to the comments, I did in fact realize that there was an issue with my assumption that $a_0 = 7$. Using the problem solving strategy exactly as before and solving for all of $a_0 = 7$, $a_0 = 8$, and $a_0 = 9$, we find that the smallest possible answer occurs when $a_0 = 9$.

Using $a_0 = 9$, we see that the smallest possible answer is, as the comments suggested, 5 digits in length.

The smallest solution therefore is $a = 89999$ and $b = 90002$.

• There's a problem with taking $a_0=7$. That's what forces you to go to a six digit answer. If you don't make that assumption, then you can get the smallest answer, and be certain that it is the smallest. Aug 9, 2015 at 6:14