Deleting a Digit Find the number of 5-digit positive integers n that have the following property: If we delete any digit in n, then we get a 4-digit number which is always divisible by 7. I did a little bit of modular arithmetic, but things got nasty.
P.S:31,16 are wrong.(It's not that easy). I think the answer is 2
 A: Suppose $abcde$ is such a number. In particular, $abcd$ and $abce$ are both divisible by $7$, so that $d\equiv e \pmod{7}$. Similar reasoning shows that in fact all of the digits are equivalent modulo $7$.
What should they be equivalent to? $1111 \pmod{7} = 5$, so $a,b,c,d,e$ must all be equivalent to $0$ modulo $7$. This gives us $2^5=32$ numbers, since each digit can be either $0$ or $7$. Actually only $31$ of these are positive.
A: Well, I solved my own question(that too with a bounty by me!). So here it is- Let the number be $abcde$. By the given property, $bcde$ and $acde$ are divisible by $7$. But then their difference $bcde−acde=1000(b−a)$ must be divisible by $7$, which means $b−a$ is divisible by $7$. In other words, $$a≡b(mod7)$$Considering other pairs of numbers, we also get $$b≡c(mod7)$$$$c≡d(mod7)$$$$ d≡e(mod7)$$ so
$$a≡b≡c≡d≡e(mod7)$$
Then $abcd≡1111a≡0(mod7)$. Since $1111$ is relatively prime to $7$, $a≡0(mod7)$, so each digit must be $0$ or $7$. The digit $a$ must be $7$, and the digit $b$ must be $7$ (since $bcde$ must be a 4-digit number), but then $c, d, e$ can be set to $0$ or $7$ arbitrarily, which gives us $2^3=8$ possible numbers.
