# How many five-digits numbers are divisible by $125$ and their digits sum are divisible by $4$

How many five-digit integers exist with the following conditions,

$$1.$$ be divisible by $$125$$

$$2.$$ Sum of their digits be divisible by $$4$$.

$$1) 176 \qquad\qquad 2)178 \qquad\qquad 3)180 \qquad\qquad 4)198\qquad\qquad 5)200$$

To solve this problem I noted that the last three digits of these numbers should be either one of the following, $$000, 125, 250, 375, 500, 625, 750, 875$$. Now if I divide the sum of each of these three digits by $$4$$, the remainder will be, $$0, 0, 3,3,1,1,0,0$$ respectively. Now for four cases, sum of the first two digits should be divisible by four, and for two cases it should be in the form $$4k+1$$ and finally for the last two cases it should be $$4k'-1$$.

Now after counting all these cases, which was relatively time-consuming, I got $$178$$ as the answer.

I'm wondering if it is possible to solve this problem with alternative approaches. Since sum of the digits of a number is related to the remainder of dividing a number by $$9$$ I think this idea would be helpful, but not sure how to implement it.

• This is the way. Sum of the digits works for divisibility by $3$ and $9$ since $10^n-1$ is divisible by $9$ and one can write every number $d_nd_{n-1}\dots d_1d_0$ as $\sum_{i=0}^nd_i\cdot10^i$. So that won't be of any help for divisibility by $4$. Jan 7 at 1:22

There are $$720$$ 5-digit numbers that are divisible by 125.

We would expect the digital sums to be approximately uniformly distributed, so close to 1/4 should have a digital sum that is divisible by 4.

The answer should be close to 180. If you wanted to guess and move on, you could take a stab.

But, what is it exactly?

As noted, the last 3 digits must be $$\in \{000,125,250,375,500,625,750,875\}$$ The associated remainders with these suffixes are $$\{0, 0, 3, 3, 1, 1, 0, 0\}$$

What are the two-digit prefixes?

With the prefixes $$10 - 89$$ we have prefixes such that the digitals sums will be uniformly distributed. i.e. there are 20 prefixes associated with each remainder.

Or, there are $$160$$ numbers in the range $$10,000 - 89,000$$ divisible by 125 with digital sums divisible by 4.

We must count the numbers for the prefixes in the range $$90 - 99$$ independently.

$$\{90,94,98\}$$ have remainder 1
$$\{91,95,99\}$$ have remainder 2
$$\{92,96\}$$ have remainder 3
$$\{93, 97\}$$ have remainder 0

Count the number that is required for each remainder.

$$2+2+2+2+3+3+2+2 = 18$$

$$178$$