# Digit sums of successive integers

For a natural number $$x$$ both, the digit sum of $$x$$ and the digit sum of $$x+1$$ are multiples of $$7$$. What is the smallest possible $$x$$?

• "0∉N" That is false. Jan 8, 2019 at 19:57
• $0 \notin \mathbb N$ is true or false depending on the application/author/etc.
– user33097
Jan 8, 2019 at 21:01
• Before anyone starts a religious war I better delete this statement. rot13(Vg jnf naljnl bayl zrnag gb thvqr crbcyr vagb gur jebat qverpgvba.) Jan 8, 2019 at 21:45

69999 (42) and 70000 (7)

...

No two consecutive integers are both multiples of 7, so this needs to take place at a rollover.

...

Rolling over a single 9 drops the digit sum by 8, which isn't a multiple of 7 either.

...

Similarly, if Y=X+1, X99->Y00 drops by 17 and X999->Y000 drops 26.

...

X9999 to Y0000 is the first drop (35) which is itself a multiple of 7...

...

Any number of 9's that's congruent mod 7 to 4 will work, but they'll be much larger, so the first instance must roll over 4 9's.

...

From there, all that remains is to find the first multiple of 10000 with an appropriate digit sum.

...

My initial, less confidence-inspiring method just recognized that 7*10^n was a likely candidate for x+1, and so I started appending 9's to a single 6 until the sum worked out...

• As this is a 'no-computers' puzzle, could you elaborate on how you find this number? Most likely you will also see whether it's minimal if you go through these steps. Jan 7, 2019 at 21:37

Suppose x+1 is of the form a*10^n, where the last digit of a is not 0. Then both digitsum(a) and digitsum(a-1)+9*n are multiples of 7. Since digitsum(a-1) = digitsum(a)-1, and the difference between any two multiples of 7 is itself a multiple of 7, we have that 9*n-1 is a multiple of 7. 9*n-1 = (7+2)n-1 = 7n+2n-1, which is a multiple of 7 iff 2n-1 is a multiple of 7. So for the smallest number, we should take 2n-1 = 7, which makes n equal to 4. The smallest possible value of a is 7, giving x = 69999.