# Counting Zeroes

**Computer Science**Level 5

Let \(N\) be the number of \(0\) digits in all the integers from \(0\) to \(M\) (including the initial \(0\)). Find the [smallest] non-trivial value of \(M > 1\) where \(N=M\).

For example, for \(M=100\), \(N=12\) (because it includes the initial 0), hence \(N≠M\), so that \(M=100\) wouldn't be the answer. There is [not] exactly one non-trivial \(M\) for which this is true, other than the trivial case \(M=1\).

You may use the computer or Wolfram Alpha.

Start counting the zeroes from \(0\), not \(1\), otherwise your program (if you're using one) will be a good example of Turing's Halting Problem.

{Edit, problem correction. Others have alerted me of the existence of at least 2 other M, both larger than the one stated as the solution, that meets the condition. I stand corrected, and the problem has been re-worded to ask for the smallest such non-trivial M. I think this problem now has just become more interesting, thanks to the contributors.]