TITLE: What is the length of the longest sequence of consecutive natural numbers, none of which has a digit sum divisible by 8? What about other divisors?
QUESTION [1 upvotes]: What is the length of the longest sequence of consecutive natural numbers, NONE of which has a digit sum divisible by 8? What about other divisors?
Denote $S(n)$ as the digit sum of $n\in \mathbb{N}$. Let $0\leq d <9$. What I found was that if $n$ ends in a $0$, then (obviously)
$$S(n+d) = S(n) + d$$
If the sum of the tens and units is less than $91$, and the number doesn't end in a $0$, we get
$$S(n+9)=S(n)$$
e.g $S(152+9)=S(161)=S(152)=8$.
Now, on the contrary, if $n$ ends in a string of $9$s and possibly but not necessarily some other nonzero digit at the end, we get
$$S(n+9)=S(n)-9k$$
where $k$ is the number of consecutive $9$s attached before the final digit.
e.g $S(193995+9)=S(194004)=S(193995)-9\cdot 2$, where there are 2 consecutive 9s before the last digit (which can also possibly be a 9).

REPLY [3 votes]: What is the length of the longest sequence of consecutive natural numbers, none of which has a digit sum divisible by 8?

Take the 10 consecutive numbers $10k+b$ with $b=0\ldots9$. Then the sum-of-digits is $S(10k+b) = S(10k) + b$.  This means that the maximal sequence of such numbers with $8\nmid S(10k+b)$ is 7.
This implies that a maximal sequence of numbers such that $8\nmid S(n)$ has a length of at most $14$: It would start at $10k+3$ and would end in the next decade at $10(k+1)+6$. So let's find such a sequence.
The conditions imply that the values which "frame" that sequence of $14$ will have a sum-of-digits that's a multiple of $8$: It's $8\mid S(10k+2)$ and $8\mid S(10(k+1)+7)$ or
$$S(k)=S(10k) \equiv 6\quad\text{ and }\quad S(k+1)=S(10(k+1)) \equiv 1$$
where $\equiv$ means modulo $8$. The 2nd condition can be met by letting $k+1$ be a power of 10: $k+1= 10^m$ and
$$k = 10^m-1 = \underbrace{999\cdots9}_{m\text{ times}}$$
thus
$$S(10k) = S(k) = 9\cdot m\equiv m \stackrel!\equiv 6$$
so that $m=6$ is a solution. Indeed, we get a sequence of $14$ values ranging from $9\,999\,993$ to $10\,000\,006$ none of which has a sum-of-digits that's divisible by $8$.
As an aside, there are infinitely many such sequences of length $14$:  The condition $m\equiv 6$ allows for infintely many $m$'s of the form $m=8\ell+6$, for example $m=14$ and $999\,999\,999\,999\,993$ to $1\,000\,000\,000\,000\,006$.

What about other divisors?

IMO, such questions are not very interesting from a mathamatical point of view because such problems depend on the representation of a number (base 10 etc.) and don't tell much or anything about numbers.
{"set_name": "stack_exchange", "score": 1, "question_id": 4494103}