Solution

If $d_{1} d_{2} d_{3}$ is simultaneously equal to $d_{4} d_{5} d_{6}$ and $d_{5} d_{6} d_{7}$, then all the digits are equal. To count the number of phones with $d_{1} d_{2} d_{3}$ equal to $d_{4} d_{5} d_{6}$, we just need to choose $d_{1} d_{2} d_{3}$ in $10 \cdot 10 \cdot 10=10^{3}$ ways and the value of $d_{7}$ in 10 ways. Therefore, there are $10^{3} \cdot 10=$ $10^{4}$ phones with $d_{1} d_{2} d_{3}$ equal to $d_{4} d_{5} d_{6}$. Similarly, there are $10^{4}$ phone numbers with $d_{1} d_{2} d_{3}$ equal to $d_{5} d_{6} d_{7}$. Discounting the phone numbers that are in both groups, we have $2 \cdot 10^{4}-10=19.990$ legal phone numbers.
We call a phone number $d_{1} d_{2} d_{3}-d_{4} d_{5} d_{6} d_{7}$ cool if the number $d_{1} d_{2} d_{3}$ is equal to $d_{4} d_{5} d_{6}$ or to $d_{5} d_{6} d_{7}$. For example, $234-2347$ is a cool phone number. Assume that each $d_{i}$ can be any digit from 0 to 9. How many cool phone numbers exist? 

#