# The number of numbers no greater than n that are divisible by all their suffixes

My question: what a formula for finding the number of numbers no greater than n that are divisible by all their suffixes.

e.g: 5, 25, 125, 0125, 70125 are divisors of 70125.

refinement: $$\overline{0...0a_1a_2...} = \overline{a_1a_2...}$$

• Here is a list of such numbers: oeis.org/A178158. Most of them appear to be of the form $a \times 10^b + c$ where $c$ is much less than $10^b$. This is not an answer but might nudge someone in the right direction. – Michael Lugo Oct 17 '18 at 17:13
• @MichaelLugo One can show that that list is complete, in the sense that all such numbers can be obtained from one of those in the list by adding extra zeros after the first digit. However the proof requires a lot of casework and is not really enlightening. – Gjergji Zaimi Oct 18 '18 at 0:16
• If by "that list" you mean Reinhard Zumkeller's b-file, it was not complete, e.g. $a(1512)$ and $a(8513)$ end in $5^{10} = 9765625$ but were not on it. I'm not sure that the current b-file is complete. – Robert Israel Oct 18 '18 at 13:12
• @GjergjiZaimi In fact it isn't. $6 \cdot 10^{67} + 98304$ is in the sequence, but no terms in the b-file end in $98304$. – Robert Israel Oct 18 '18 at 14:24
• Similarly for $2 \cdot 10^{109} + 1953125$. – Robert Israel Oct 18 '18 at 14:32

Here's a start. If $$y \cdot 10^d + z$$ is such a number (with $$y \in \{1,2,\ldots,9\}$$ and $$1 \le z < 10^d$$), then $$z \mid y \cdot 10^d$$.