Number theory question from today's Pre - RMO How many positive integers less than 1000 have the property that the sum of the digits of each such number is divisible by 7 and the number itself is divisible by 3?
By my comment above we are looking for three digits such that they sum to exactly $21$. This is possible as follows:

\begin{eqnarray}
9+9+3&amp;=&amp;21\\
9+8+4&amp;=&amp;21\\
9+7+5&amp;=&amp;21\\
\vdots&amp;=&amp; \vdots\\
9+3+9&amp;=&amp;21\\
8+9+4&amp;=&amp;21\\
8+8+5&amp;=&amp;21\\
\vdots&amp;=&amp;\vdots\\
8+4+9&amp;=&amp;21\\
7+9+5&amp;=&amp;21\\
\vdots&amp;=&amp;\vdots\\
7+5+9&amp;=&amp; 21\\
\vdots&amp;=&amp;\vdots\\
\end{eqnarray}

Can you spot the pattern in the list? It's not too difficult to count the number of such solutions without writing all of them down. There are $28$ solutions.
Answer is 21 because the first number which is multiple of both 7 and 3 is 21