# Consecutive integers with digit sum divisible by 19

What is the smallest positive integer N, such that the digit sum of N and N+1 are both divisible by 19?

• Are you asking about digit sum (N) + digit sum (N+1) being divisible by 19, or the digit sums of N and N+1 each being divisible by 19? – Punintended Jan 13 at 21:10
• @Punintended The wording is ambiguous. It should be "the digit sums of N and N+1 are both divisible by 19" else it's too simple. – xhienne Jan 13 at 21:18
• @xhienne I figured that was the case, but Glorfindel beat me to the answer so I was hoping it was the latter ;P – Punintended Jan 13 at 21:25
• Thanks for the hint of the wording, I corrected it! – ThomasL Jan 13 at 22:23

$$N = 199 \cdot 10^{17} - 1 = 1989999999999999999999$$ (digit sum 171 = 9 * 19)
$$N + 1 = 199 \cdot 10^{17} = 1990000000000000000000$$ (digit sum 19)
The number $$N$$ ends in $$n$$ nines, where $$n \ge 0$$. The difference between the digit sum of $$N + 1$$ and $$N$$ is $$1 - 9n$$. Both digit sums are divisible by $$19$$, so their difference must be as well. The smallest $$n$$ for which $$1 - 9n$$ is divisible by $$19$$ is $$n = 17$$, so $$N$$ must end in $$17$$ nines, for a digit sum of $$153$$. The next multiple of $$19$$ is $$171$$, so the remaining digits of $$N$$ must add up to $$171 - 153 = 18$$. Two nines is not possible, since the number must end in $$17$$ nines, not $$19$$. The next number that qualifies is $$198$$.