Maths Olympiad Prep

Library / /57 of 73

Number theory Difficulty 6.6 National Olympiad Prove it Brazil

What is the smallest positive integer nn such that there exists a positive integer kk such that the last 2012 digits of nkn^k are all equal to 1?

Solution

Answer: 71.

Since 1112012 ones=10201219\underbrace{11\dots1}_{2012 \text{ ones}} = \frac{10^{2012}-1}{9}, the problem is equivalent to finding the smallest nn such that, for some kk,
nk10201219(mod102012)9nk1(mod102012)    nk9(mod102012)    {nk9(mod22012)nk9(mod52012) \begin{align*} n^k &\equiv \frac{10^{2012} - 1}{9} \pmod{10^{2012}} \\ 9n^k &\equiv -1 \pmod{10^{2012}} \\ &\iff n^{-k} \equiv -9 \pmod{10^{2012}} \\ &\iff \left\{ \begin{array}{l} n^{-k} \equiv -9 \pmod{2^{2012}} \\ n^{-k} \equiv -9 \pmod{5^{2012}} \end{array} \right. \end{align*}

Let's look at nkmod8n^{-k} \bmod 8 first. It's immediate that nn is odd. Since 123252721(mod8)1^2 \equiv 3^2 \equiv 5^2 \equiv 7^2 \equiv 1 \pmod 8, we must have n7(mod8)n \equiv 7 \pmod 8 and k-k odd. Now look at it mod 16: let k=mk = -m and n=8u1n = 8u - 1. Then
(8u1)m1+8um(mod16) (8u - 1)^m \equiv -1 + 8um \pmod{16}

and
nm9(mod16)8um19(mod16)    um1(mod2), \begin{align*} n^m &\equiv -9 \pmod{16} \\ 8um - 1 &\equiv -9 \pmod{16} \\ &\iff um \equiv 1 \pmod{2}, \end{align*}

that is, uu is odd. Therefore n=8(2t+1)17(mod16)n = 8(2t + 1) - 1 \equiv 7 \pmod{16}.

Now look at nkmod5n^{-k} \bmod 5: since k-k is odd, and 131(mod5)1^3 \equiv 1 \pmod 5, 233(mod5)2^3 \equiv 3 \pmod 5, 332(mod5)3^3 \equiv 2 \pmod 5 and 434(mod5)4^3 \equiv 4 \pmod 5, we must have n1(mod5)n \equiv 1 \pmod 5. Putting everything together, we have n7(mod16)n \equiv 7 \pmod{16} and n1(mod5)    n71(mod80)n \equiv 1 \pmod 5 \implies n \equiv 71 \pmod{80}, and thus n71n \ge 71.

We claim that n=71n = 71 does the job. First notice that, by the Lifting the Exponent lemma, ν2(71N1)=ν2(7121)+ν2(N)1=ν2(N)+3\nu_2(71^N - 1) = \nu_2(71^2 - 1) + \nu_2(N) - 1 = \nu_2(N) + 3 and ν5(71N1)=ν5(711)+ν5(N)=ν5(N)+1\nu_5(71^N - 1) = \nu_5(71 - 1) + \nu_5(N) = \nu_5(N) + 1.

Now, notice that this implies 71v71w(mod2t)71^v \equiv 71^w \pmod{2^t}     71vw1(mod2t)\iff 71^{v-w} \equiv 1 \pmod{2^t}     ν2(vw)+3t    2t3vw    vw(mod2t3)\iff \nu_2(v-w) + 3 \ge t \iff 2^{t-3} \mid v-w \iff v \equiv w \pmod{2^{t-3}}. We analyze now the possible residues of 71N(mod2t)71^N \pmod{2^t}: first, we know that 717(mod16)71 \equiv 7 \pmod{16}, and 7121(mod16)71^2 \equiv 1 \pmod{16}, so all residues 71N(mod2t)71^N \pmod{2^t} are congruent to either 1 or 7(mod16)7 \pmod{16}, so one eighth of the residues appear, in a total of 2t32^{t-3} residues. But 71v71w(mod2t)71^v \equiv 71^w \pmod{2^t}     vw(mod2t3)\iff v \equiv w \pmod{2^{t-3}}, so there are at most 2t32^{t-3} residues. This means that the residues are all numbers congruent to 1 or 7(mod16)7 \pmod{16}. So, for all t4t \ge 4 there is NN such that 71N9(mod2t)71^N \equiv -9 \pmod{2^t}. Notice that NN is unique mod 2t32^{t-3}.

The same argument applies mod 5t5^t: all residues of 71N(mod5t)71^N \pmod{5^t} are congruent to 1(mod5)1 \pmod 5 and 71v71w(mod5t)    71vw1(mod5t)    ν5(vw)+1t    5t1vw    vw(mod5t1)71^v \equiv 71^w \pmod{5^t} \iff 71^{v-w} \equiv 1 \pmod{5^t} \iff \nu_5(v-w) + 1 \ge t \iff 5^{t-1} \mid v-w \iff v \equiv w \pmod{5^{t-1}}. One fifth of the residues appear, all of them congruent to 1 mod 5. So the residues are all numbers congruent to 1 mod 5, and for all t2t \ge 2 there is NN such that 71N9(mod5t)71^N \equiv -9 \pmod{5^t}. Notice that NN is unique mod 5t15^{t-1}.

We can finish the problem now: we only need to find NN that is congruent to a number mod 2t2^t and to a number mod 5t5^t, but it exists due to the Chinese remainder theorem. Now plug t=2012t = 2012.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.