How many poor numbers are there?

200 Views Asked by At

A number $n$ is called poor if there does not exist a positive integer $m$ such that $m!$ has exactly $n$ trailing zeros. How many poor numbers are less than or equal to $2018$?

The question is from annual city math contest $2018$. I have made the following progress to solve the problem:

It is known that $m!$ has $Z=\lfloor\frac m5\rfloor+\lfloor\frac m{25}\rfloor+\dots$ trailing zeros. If $m$ is divisible by $5$, all the numbers $m!$, $(m+1)!$, $(m+2)!$, $(m+3)!$, $(m+4)!$ has the same number of trailing zeros. So, we take only the $m$s that are divisible by $5$.

$m!$ has $4$ trailing zeros for $m=24$. But $25!$ has $6$ trailing zeros. Since $Z$ is always increasing (not necessarily strict), we get that $5$ is a poor number. This happens for all multiples of $25$ i.e a number is skipped skipped from the value of $Z$ and the skipped number is always a poor one. Similarly, two numbers are skipped for the multiples of $125$. More generally, if $m$ is a multiple of $5^k$, $k-1$ numbers get skipped from the values of $Z$ or equivalently we get $k-1$ poor numbers for each such $m$.

Now based on the observations above, I calculated first few poor numbers. They are: $$5,11,17,23,29,30, 36, 42, 48, 54, 60, 61,\dots $$ The sequence is quite interesting and matches with A000966. However, I am unable to find the number of poor numbers that are less than or equal to $2018$.

1

There are 1 best solutions below

0
On

Hint: There is a strictly increasing bijection between non-poor numbers and multiples of 5.

So, find the least $k$ such that $(5k)!$ has at least 2018 zeros, and your answer will be $2018 - k$.