# How many 5 digit positive integers are divisible by 5 and without repetition of digits?

The answer key on the back of Combinatorics A Problem Based Approach by Pavle Mladenovic says it's 512 but I don't think that's right.

Here's my thought process:

A 5 digit number divisible by 5 means the ones digit is 0 or 5

Case last Digit is 5:

1st Digit: (1-9) choices but can't have 5 because it would repeat the last digit so possible choices are 8

2nd Digit: (0-9) choices but can't have 5 and can't have the previous digit so 8 choices

3rd Digit: (0-9) Choices but can't have 5 and the previous digit so 7 choices

4th Digit: (0-9) choices but can't have 5 and previous 3 digits so 6 choices

5th Digit: Must have 5 so 1 choice

Product: 8 * 8 * 7 * 6 * 1 = 2688 possible numbers

Case last Digit is 0:

1st Digit: (1-9) choices so 9

2nd Digit: (0-9) choices but last digit is 0 and cant repeat previous digit so 8 choices

3rd Digit: (0-9) choices but last digit is 0 and can't repeat previous 2 so 7 choices.

4th Digit: (0-9) choices but last digit is 0 and can't repeat previous 3 choices so only 6 choices.

5th Digit Last Digit is 0 so only 1 choice.

Product: 9 * 8 * 7 * 6 = 3024

Total Choices is 2688 + 3024 = 5712.

How do you get 512 from this question?

• It might be just a typo. Accidentally forgetting the 7. I could be wrong, though.
– user1135823
Apr 17, 2023 at 2:58
• To the original poster: Your analysis looks good. Apr 17, 2023 at 4:48
• Thanks!! I thought something was strange Apr 17, 2023 at 23:48

Let $$a_i$$ be the $$i$$th digit of a $$5$$-digit number divisble by $$5$$.
If $$a_5=5$$, then $$a_1$$ can be $$1,\dots,4,6\dots,9$$, so there are $$8$$ choices for $$a_1$$ in this case.
If $$a_5=0$$, then $$a_1$$ can be $$1,\dots,9$$, so there are $$9$$ choices for $$a_1$$ in this case.
Therefore, there are $$8+9=17$$ chocies for $$(a_1,a_5)$$ pairs.
Now, $$(a_2,a_3,a_4)$$ can be any permutation constructed from any digits that are not $$a_1$$ and not $$a_5$$.
Therefore, we have to determine the number of permutations of $$3$$ digits from $$10-2=8$$ digits, which is $$8\cdot 7\cdot 6=336$$.
Finally, any $$5$$-digit number divisible by $$5$$ can be obtained from any combination of $$(a_1,a_5)$$ and $$(a_2,a_3,a_4)$$, and any such combination also results in a $$5$$-digit number divisible by $$5$$, so the answer is $$17\cdot 336=5712$$.