At first a dashed off some code to try a brute force solution, but while the program was running forever, I elected to actually think about it instead.
The smallest number with sod=49 is 499999 but then then n+1 has sod of 5.
If n ends with anything other than 9, then sod(n+1) = sod(n) + 1, so our number must end in 9.
If n ends with a string of k 9's then sod(n+1) - sod(n) = 8 + (k-1)*9
The smallest k such that sod(8 + (k-1)*9) is 0 is for k = 11.
So, for example, n equal to a 1 followed by 11 9's has an sod = 100, in which case n+1 would be a 2 followed by 11 zeros so sod = 2, a difference of 98 which is a multiple of 49.
So our number must end in a string of 11 9's, (sod = 99) but it's overall sod must be 147, a multiple of 49.
So our number's "prefix" must have an sod of 48. The smallest such number would be 399999, except the prefix cannot end in 9 or this would make a longer string of 9's at the end. So the smallest prefix with sod 48 and ending in a non-9 is 499998.
49,999,899,999,999,999 sod = 147
49,999,900,000,000,000 sod = 49
Posted by Larry
on 2020-07-20 11:05:28