How many 7-digit numbers formed by using only the digits $3$ and $7$, and divisible by $21$ are there?
Well, I let the number be abcdefg and:
- Placing $3$ at any position gives $0 \bmod 3$
- Placing $7$ at all positions a,b,c,d,e,f,g gives $1 \bmod 3$
Then for abcdefg to be divisible by $3$, there would be $7C3 + 7C0 +7C6$ options
Next:
- Placing $7$ at any position gives $0 \bmod 7$
- Placing $3$ at $a$ gives $3 \bmod 7$, $b$ gives $2 \bmod 7$, $c$ gives $6 \bmod 7$, $d$ gives $4 \bmod 7$, $e$ gives $5 \bmod 7$, $f$ gives $1 \bmod 7$, $g$ gives $3 \bmod 7$
And then I was going to do the same thing as before but how do I sort of link it back to divisibility by $21$? Is it PIE or something? Any hint would be appreciated. Thank you.
Edit: Oops, I realised that I've solved it already. So I used the mod values for 7 obtained above and selected any 3 or 6 out of a,b,c,d,e,f,g , to take the value 3, that would add up to be divisible by 7 and since the sum of the digits would add up to 3, they would be divisible by 21 naturally. The combinations are (a,f,g), (a,c,e), (c,e,g), (b,d,f), (a,b,c,d,e,f) and (b,c,d,e,f,g). Therefore, the answer is 6 which is correct. But if anyone has any other solution that is simpler or more elegant, do let me know as well!