How many prime numbers between 1000-10000 (inclusive) that if you take the sum of their digits, that number is divisible by 8? Every year I attempt to compete in math competitions at my school and I encounter problems such as...

How many prime numbers between 1000-10000 (inclusive) that if you take the sum of their digits, that number is divisible by 8. For example 17, 1+7=8. Which is divisible by 8. 

We have to show our work. Does anyone have a solutions for these types of problems and how I could solve the problem above.
 A: Another approach is to start with all the three-digit numbers from $100$ to $999$.  You append a units digit to each one to make the total digital sum $8$, $16$, or $32$ (not $24$ as this would imply a multiple of $3$).  Each four-digit number is then tested for primality.
You do not really need to keep all the three-digit starting numbers.  Those where the sum of the three digits is even are rejected because the units digit would have to be even, which is a problem.  We also find:
Three-digit sums of $17$, $19$, and $21$ fail because we can't get the four-digit sum to $32$.
Three-digit sums of $3$, $11$, and $27$ fail because the appended units digit is $5$.
A three-digit sum of $7$ allows two candidates with $1$ or $9$ as a units digit, but other surviving three-digit sums give only one candidate per three-digit seed.
With these properties you drop your trials to a few hundred.  Here is the beginning of the list of candidates:
1007
1043
1061
1069
1087
1133
1151
1159
1177
1223
1241
1249
1267
1313
1331
1339
1357
1393
1403
1421
1429
1447
1483
1511
1519
1537
1573
1591
1601
1609
1627
1663
1681
1717
1753
1771
1807
1843
1861
1933
1951
etc.
