How to find the largest prime number where 2012! in the base of the number has at least that many trailing zeros.

318 Views Asked by At

Find the largest prime number $p$ such that when $2012!$ is written in base $p$, it has at least $p$ trailing zeroes.

I know that $2012!$ has $501$ trailing zeros. I don't know what to do next or how to use that information.

1

There are 1 best solutions below

1
On

The last $k$ digits of a number in base $p$ represent its value modulo $p^{k}$. The last $p$ digits in base $p$ are all zero iff the number is divisible by $p^p$. Now, for any prime $p$, the number of powers of $p$ that divide $N!$ is given by $$ \left\lfloor\frac{N}{p}\right\rfloor+\left\lfloor\frac{N}{p^2}\right\rfloor+\left\lfloor\frac{N}{p^3}\right\rfloor+\ldots $$ So you want the largest prime $p$ such that $$ \left\lfloor\frac{N}{p}\right\rfloor+\left\lfloor\frac{N}{p^2}\right\rfloor+\left\lfloor\frac{N}{p^3}\right\rfloor+\ldots \ge p, $$ with $N=2021$. Looks like this will generally be $p \approx \sqrt{N}$, and here it's easy to check that $p=43$ is correct.