7 digit number consisting of 7s and 5s Find all the 7 digit numbers that have only 5 and 7 as their digits and divisible by both 5 and 7. I have no clue how to use divisibility of 7 to solve this problem. DO i need to check all the 64 combinations?
 A: The number has to be of the form $abcdef5$. Putting a $7$ at either of the places $a,b,c,d,e,f$ gives a contribution $0$ mod $7$. Putting a $5$ gives a different contribution mod $7$ depending on the place where you put it. A $5$ at position $a,b,c,d,e,f$ gives a contribution mod $7$ of respectively $5,4,6,2,3,1$. Each number of the form $abcdef5$ can be identified with the subset of $\{a,b,c,d,e,f\}$ of positions where a $5$ is put. For the number to be divisible by $7$ we require the sum of contributions mod $7$ from the first six digits to be $2$, as together with the $5$ at the end this will give us $0$ mod $7$. A quick check now gives the following:
Sum 2: $\{d\}$
Sum 9: $\{f,d,c\}$ $\{f,e,a\}$  $\{d,e,b\}$  $\{e,c\}$  $\{b,a\}$
Sum 16: $\{f,d,e,b,c\}$ $\{d,e,a,c\}$  $\{f,b,a,c\}$ 
So all the numbers are $7775775$, $7755755$, $5777555$, $7575575$, $7757575$, $5577775$, $5777775$, $5755575$ and $5557755$.
A: You can use the fact that $7$ divides $1001$ to say that if $7$ divides $abcdefg$ it also divides $a+bcd+efg$ and you already recognized that $g=5$.  This gives you two unknown digits in each place and $5,7$ is interchangeable with $7,5$.  This reduces the possibilities to $27$.  I don't see a quick way to improve on that.
