0

For example ,

15 - 15*4=60 - minimum number with max trailing zeros when multiplying with 4 or 7

125 - 125*4*4=2000

400 - 400 will be the answer as its the minimum number with max trailing zeros.

IF possible , I also want to know another different cases too like case 2 and case 3 as mentioned above which requires to think differently.

Thanks In Advance.

1 Answers1

1

The number of trailing zeroes in a number is equivalent to the number of times $10$ can divide into the number. That is, the trailing zeroes in $n$ is the largest $k$ such that $10^k | n$, where '$|$' means 'divides into'.

$10 = 5 \cdot 2$. So find $j$, number of times $2$ divides into $n$, and $k$, the number of times $5$ divides into $n$, and the number of trailing zeroes is the minimum of $j$ and $k$.

$15 = 3 \cdot 5$. So it just needs one more multiply by $2$ to reach its maximal number of trailing zeroes. $4 = 2 \cdot 2$, so you only need one $4$.

$125 = 5^3$. So you need $3$ powers of $2$. Each $4$ has $2$ powers of 2, so you need $2$ of them.

NovaDenizen
  • 4,216
  • 15
  • 23