I saw a question in my math book, it seems very trivial, it says that:
How many four digits numbers are there not containing zero and multiplication of its digits divisible by 7?
I thought of:
(all four digits numbers not containing zero) minus (all four digits numbers not containing 7 and 0)
in order to find all four digits number not containing zero and multiplication of its four digits divisible by 7.
Then $(9^4)-(8^4)=2465$. However the answer is $4904$. What am I missing?
Your first answer is right in regard of the statement you gave, indeed:
Let $(a,b,c,d) \in \{1,2,3,4,5,6,7,8,9\}^4$. So $A = 1000a+100b+10c+d $ is a four-digit number.
Morevover, $a\cdot b \cdot c \cdot d $ is divisible by $7$, if and only if, its prime factorization contains at least one time $7$ so, if and only if, at least one of $A$'s digit is equal to $7$. Hence the answer is $9^4-8^4 = 2465$ as you said.
However if you are looking for the number of four-digit numbers such that the product of their digits is divisible by $7$ the answer is $4904 = 8(10^3-8^3) + 10^3$. You can check that: in order for a four-digit number $A$ to have the product of its digits divisible by $7$, it must contain $0$ or $7$.
Let $A = 1000a+100b+10c+d$ where $0\leq a,b,c,d \leq 9$ are integers and $a \neq0$.
If $a=7$ then you can have all the combinations possible for $b,c$ and $d$. Thus, it gives you $10^3$ choices.
If $a \neq 7$, then you are looking for the number $n$ of possibilities to have at least $b,c$ or $d$ equals to $0$ or $7$. Morevover, you have exactly $8^3$ possibilities for $b$, $c$ and $d$ not to be equal to $0$ nor $7$. Hence $n = 10^3-8^3$. Finally there are only $8$ possibilities for $a$ to be different from $7$.
Therefore the number you are looking for is $8(10^3-8^3)+10^3 = 4904$.