How many 4 digit numbers are divisible by 29 such that their digit sum is also 29? How many $4$ digit numbers are divisible by $29$ such that their digit sum is also $29$?
Well, answer is $5$ but what is the working and how did they get it?

Given the $4$-digit number $\overline{abcd}$, the sum of digits being divisible by $29$ implies:
$$a+b+c+d=29,$$
because: $29<4\cdot 9<58$.
$\overline{abcd}$ is being divisible by $29$ implies:
$$1000a+100b+10c+d\equiv 14a+13b+10c+d\equiv 0\pmod{29}.$$
Hence:
$$\begin{cases} \ \ \ \ a+\ \ \ \ b+\ \ \ \ c+d=29 \\
14a+13b+10c+d=29n\end{cases}.$$
Multiply the first by $14$ and subtract the second:
$$b+4c+13d=29(14-n),9\le n<14,$$
because: $9+4\cdot 9+13\cdot 9=162<29\cdot 6=174$.
It is easy to check ($2\le b,c,d\le 9$):
$$\begin{align}&n=9 \Rightarrow b+4c+13d=145 \\
& \ \ \ d=9 \Rightarrow (b,c)=\color{red}{(4,6)}; (8,5);\\
&\ \ \ d=8 \Rightarrow (b,c)=(5,9); (9,8); \\
&\ \ \ (b,c,d)=(8,5,9), (5,9,8), (9,8,8);\\
&n=10 \Rightarrow b+4c+13d=116 \\
&\ \ \ d=8 \Rightarrow  (b,c)=\color{red}{(4,2)};\\
&\ \ \ d=7 \Rightarrow (b,c)=\color{red}{(5,5)}; (9,4);\\
&\ \ \ d=6 \Rightarrow (b,c)=\color{red}{(2,9)}; (6,8);\\
&\ \ \ (b,c,d)=(9,4,7), (6,8,6);\\
&n=11 \Rightarrow b+4c+13d=87 \\
&\ \ \ d=5 \Rightarrow  (b,c)=\color{red}{(2,5)}; \color{red}{(6,4)};\\
&\ \ \ d=4 \Rightarrow (b,c)=\color{red}{(3,8)}; \color{red}{(5,7)}; \color{red}{(9,6)}.
\end{align}$$
Hence:
$$\overline{abcd}=7859; 7598; 4988; 9947; 9686.$$
