TITLE: Finding numbers satisfying a given condition
QUESTION [5 upvotes]: How many 4-digit number exists , such that the sum of it's digit is $29$ & also the number is divisible by $29$?
I literally don't know how to approach this question . What is the basic concept that would be used in solving these type of questions ?Please let me know !!

REPLY [12 votes]: the smallest four digit number which is divisible by $29$ is $1015$.  Hence all your numbers are of the form $1015+29k$.  
Now, the digit sum is $29$ which implies that the iterated digit sum is $2$, thus we only want to consider numbers which are $2\pmod 9$.  The smallest number of the form $1015 +29k$ with this property is $1073$.  Thus all your numbers are of the form $1073+(29\times 9)k=1073+261k$.  
There are only $35$ such numbers and it is now easy to check by hand (well, tedious but doable with pencil and paper. Effortless with a calculator).  We see that the only examples are $$\{4988,7598,7859,9686,9947\}$$

REPLY [5 votes]: Let's write the number as $abcd$ where $a$, $b$,$c$ and $d$ are the digits. Your condition is equivalent to
\begin{align}
a+b+c+d &= 29 \\
1000a+100b+10c+d &= 29*k \quad k\in \mathbb{N}
\end{align}
You have to consider all the possible ways $abcd$ can be arranged and check which ones satisify the above conditions. There is possibly a clever number theoretic inspired algorithm to do this but you can do a brute force approach.
The python code below gives me the following result.
$$
4988\quad 7598\quad 7859\quad 9686\quad 9947
$$
Code: 
import numpy as np

possible_number_list = np.arange(1000,10000,1)

for i in possible_number_list:

    if i%29==0 and sum(int(digit) for digit in str(i))==29:
        print i