Problem 1.20 Easy Free

Integers Containing a Zero

Among the positive integers from 11 to 1000010000, how many contain the digit 00 at least once?

Work it out, then compare with the answer.

SolutionShow the worked solution

Count the complement. A kk-digit positive integer with no digit 00 has each of its kk digits chosen from {1,…,9}\{1,\dots,9\}. Every such string is a genuine kk-digit number, because its leading digit is not zero. So there are 9k9^k of them.

The integers from 11 to 99999999 are exactly the integers with one to four digits. The number 1000010000 contains a zero, so it is not zero-free. The number of zero-free integers in the range is therefore

9+92+93+94=9+81+729+6561=7380.9+9^2+9^3+9^4 = 9+81+729+6561 = 7380 .

Subtracting this from the 1000010000 integers in the range gives

10000−7380=2620.10000-7380 = 2620 .
2620\boxed{2620}

Key idea. “At least one 00“ is awkward to count directly. ”No 00” is easy if the numbers are split by length, because then the leading-digit restriction takes care of itself.