Daily

Random

Practice set

Baltic Way 1998 · Problem 5

Number Theory

Let aa be an odd digit and bb an even digit. Prove that for every positive integer nn there exists a positive integer, divisible by 2n2^{n}, whose decimal representation contains no digits other than aa and bb.

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Divisibility and factorization · Modular arithmetic

Solutions

Solution 1

Solution: If b=0b=0, then N=10naN=10^{n} a meets the demands. For the sequel, suppose b≠0b \neq 0.

Let nn be fixed. We prove that if 1⩽k⩽n1 \leqslant k \leqslant n, then we can find a positive integer mk<5km_{k}<5^{k} such that the last kk digits of mk2nm_{k} 2^{n} are all aa or bb.

Clearly, for k=1k=1 we can find m1m_{1} with 1⩽m1⩽41 \leqslant m_{1} \leqslant 4 such that m12nm_{1} 2^{n} ends with the digit bb. (This corresponds to solving the congruence m12n−1≡b2m_{1} 2^{n-1} \equiv \frac{b}{2} modulo 5.) If n=1n=1, we are done. Hence let n⩾2n \geqslant 2.

Assume that for a certain kk with 1⩽k<n1 \leqslant k<n we have found the integer mkm_{k}. Let cc be the (k+1)(k+1)-st digit from the right of mk2nm_{k} 2^{n} (i.e., the coefficient of 10k10^{k} in its decimal representation). Consider the number 5k2n5^{k} 2^{n}: it ends with precisely kk zeros, and the last non-zero digit is even; call it dd. For any rr, the corresponding digit of the number mk2n+r5k2nm_{k} 2^{n}+r 5^{k} 2^{n} will be c+rdc+r d modulo 10. By a suitable choice of r⩽4r \leqslant 4 we can make this digit be either aa or bb, according to whether cc is odd or even. (As before, this corresponds to solving one of the congruences r⋅d2≡a−c2r \cdot \frac{d}{2} \equiv \frac{a-c}{2} or r⋅d2≡b−c2r \cdot \frac{d}{2} \equiv \frac{b-c}{2} modulo 5.)

Now, let mk+1=mk+r5km_{k+1}=m_{k}+r 5^{k}. The last k+1k+1 digits of mk+12nm_{k+1} 2^{n} are all aa or bb. As mk+1<5k+4⋅5k=5k+1m_{k+1}<5^{k}+4 \cdot 5^{k}=5^{k+1}, we see that mk+1m_{k+1} has the required properties. This process can be continued until we obtain a number mnm_{n} such that the last nn digits of N=mn2nN=m_{n} 2^{n} are aa or bb. Since mn<5nm_{n}<5^{n}, the number NN has at most nn digits, all of which are aa or bb.

Solution 2

Solution: The case b=0b=0 is handled as in the first solution. Assume that b≠0b \neq 0. We prove the statement by induction on nn, postulating, in addition, that NN (the integer we are looking for) must be an nn-digit number.

For n=1n=1 we take the one-digit number bb. Assume the claim is true for a certain n⩾1n \geqslant 1, with N≡0( mod 2n)N \equiv 0\left(\bmod 2^{n}\right) having exactly nn digits, all aa or bb; thus N<10nN<10^{n}. Define

N∗={10nb+N if N≡0( mod 2n+1)10na+N if N≡2n( mod 2n+1).N^{*}= \begin{cases}10^{n} b+N & \text{ if } N \equiv 0\left(\bmod 2^{n+1}\right) \\ 10^{n} a+N & \text{ if } N \equiv 2^{n}\left(\bmod 2^{n+1}\right) .\end{cases}

Clearly, N∗N^{*} is an (n+1)(n+1)-digit number, satisfying

N∗≡{0+0( mod 2n+1) in the first case 2n+2n( mod 2n+1) in the second case. N^{*} \equiv \begin{cases}0+0\left(\bmod 2^{n+1}\right) & \text{ in the first case } \\ 2^{n}+2^{n}\left(\bmod 2^{n+1}\right) & \text{ in the second case. }\end{cases}

In both cases N∗N^{*} is divisible by 2n+12^{n+1}, and we have the induction claim. The result follows.

Contest context

Results from Baltic Way 1998

11 teams

Mean score
4.0 / 5
Scores of 4 or 5
9 / 11
Estonia
5 / 5

Score distribution

02
10
20
30
41
58
All team scores
TeamScore
Latvia5 / 5
Estonia5 / 5
Poland5 / 5
Finland5 / 5
St. Petersburg5 / 5
Sweden4 / 5
Denmark0 / 5
Iceland5 / 5
Norway5 / 5
Germany0 / 5
Lithuania5 / 5