The $2019$th strictly positive integer $n$ such that $\binom{2n}{n}$ is not divisible by $5$

contest-mathelementary-number-theoryintuition

This is problem $6$ from the $2019$ Pan African Mathematical Olympiad.

Here's my attempt:

We're looking for all integers $n$ such that $5$ doesn't divide $\binom{2n}{n}$.

Which means we need $v_5((2n)!) – 2 v_5(n!) = 0$

By Legendre's formula, this is equivalent to:

$$
\sum_{k = 1}^\infty \left\lfloor \frac{2n}{5^k} \right\rfloor – 2\sum_{k = 1}^\infty \left\lfloor \frac{n}{5^k} \right\rfloor = 0 \\
\iff \sum_{k = 1}^\infty \left(\left\lfloor \frac{2n}{5^k} \right\rfloor – 2\left\lfloor \frac{n}{5^k} \right\rfloor\right) = 0
$$

Which is true if and only if $\left\lfloor \frac{2n}{5^k} \right\rfloor = 2\left\lfloor \frac{n}{5^k} \right\rfloor$ for all strictly positive integers $k$.

Let's find the positive real solutions to the equation $\lfloor2x\rfloor = 2 \lfloor x \rfloor$

$$
\lfloor2x\rfloor = 2 \lfloor x \rfloor \\
\iff 2x – \{2x\} = 2x – 2 \{x\} \\
\iff \{2x\} = 2 \{x\}
$$

Which is true if $\{x\} < 1/2$.

Inversely, if $\{x\} > 1/2$ then $\{2x\} > 1$ which is absurd.

It's also trivially false for $x = 1/2$.

As such, for every strictly positive integer $k$, there exists a positive integer $m_k$ such that:
$$
m_k \le \frac{n}{5^k} < m_k + \frac1{2} \\
\iff 5^k m_k \le n < 5^k m_k + \frac{5^k}{2}
$$

I can see that this can be used to eliminate many possible remainders of $n$ modulo any power of $5$.

For example, we have:
$$
5 m_1 \le n < 5 m_1 + \frac{5}{2} \\
\iff 5 m_1 \le n \le 5m_1 + 2
$$

Which means $n \mod 5 \in \{0 , 1, 2 \}$

And similarly,
$$
25 m_2 \le n \le 25m_2 + 12
$$

So $n \mod 25 \in [0,12]$

But, since $n \mod 5 \in \{0,1,2\}$, we have $n \mod 25 \in \{0,1,2,5,6,7,10,11,12\}$

We can carry on with this for higher powers of $5$.

However, I don't know how exactly to proceed from here.

I don't just want an answer.

I want the reasoning and intuition behind your answer in order to know how I should approach such problems in the future so I would really appreciate it if you include a little bit about how you found the solution if it's not really obvious. I don't mind if you also include failed attempts on the way to finding the solution.

Best Answer

A possible way to find the answer:

Exploring the numbers for which $\left\lfloor \frac{2n}{5} \right\rfloor - 2 \left\lfloor \frac{n}{5} \right\rfloor =0$ shows the $3$ out of every $5$ integers satisfy this, with the $3$th, $6$th etc. cases being multiples of $5$.

Similarly exploring the numbers for which $\left\lfloor \frac{2n}{5^2} \right\rfloor - 2 \left\lfloor \frac{n}{5^2} \right\rfloor =0$ shows that $13$ out of every $25$ integers satisfy this, with the $13$th, $26$th etc. cases being multiples of $25=5^2$. Overlapping this with the previous result, $9$ out of every $25$ integers satisfy these two.

You can then prove that $\left\lfloor \frac{2n}{5^k} \right\rfloor - 2 \left\lfloor \frac{n}{5^k} \right\rfloor =0$ if and only if $n \in \{0,1,2,\ldots,\frac{5^k-1}{2}\} \mod 5^k$

and by induction that $\sum\limits_{k = 1}^t \left\lfloor \frac{2n}{5^k} \right\rfloor - 2\sum\limits_{k = 1}^t \left\lfloor \frac{n}{5^k} \right\rfloor = 0 $ for $3^t$ out of every $5^t$ integers with the $3^t$th, $2\times 3^t$th etc. being multiples of $5^t$.

To find the solution using this information:

  • we can find $3^6=729\le 2019$ and $3^7=2187>2019$. So $t=7$ is too big.

  • $2019 = 2\times 729+2\times243 + 2\times 27 + 2\times 9 +1\times 3$ which is $2\times 3^6+2\times3^5 + 2\times 3^3 + 2\times 3^2 +1\times 3^1$.

  • The desired $n=2\times 5^6+2\times5^5 + 2\times 5^3 + 2\times 5^2 +1\times 5 ^1 = 37805$