# Baltic Way 2006
Turku, November 3, 2006 ## Problems and solutions 1. For a sequence $a_{1}, a_{2}, a_{3}, \ldots$ of real numbers it is known that $$ a_{n}=a_{n-1}+a_{n+2} \quad \text { for } n=2,3,4, \ldots $$ What is the largest number of its consecutive elements that can all be positive? Answer: 5. Solution: The initial segment of the sequence could be $1 ; 2 ; 3 ; 1 ; 1 ;-2 ; 0$. Clearly it is enough to consider only initial segments. For each sequence the first 6 elements are $a_{1} ; a_{2}$; $a_{3} ; a_{2}-a_{1} ; a_{3}-a_{2} ; a_{2}-a_{1}-a_{3}$. As we see, $a_{1}+a_{5}+a_{6}=a_{1}+\left(a_{3}-a_{2}\right)+\left(a_{2}-a_{1}-a_{3}\right)=$ 0 . So all the elements $a_{1}, a_{5}, a_{6}$ can not be positive simultaneously. 2. Suppose that the real numbers $a_{i} \in[-2,17], i=1,2, \ldots, 59$, satisfy $a_{1}+a_{2}+\cdots+a_{59}=0$. Prove that $$ a_{1}^{2}+a_{2}^{2}+\cdots+a_{59}^{2} \leq 2006 . $$ Solution: For convenience denote $m=-2$ and $M=17$. Then $$ \left(a_{i}-\frac{m+M}{2}\right)^{2} \leq\left(\frac{M-m}{2}\right)^{2}, $$ because $m \leq a_{i} \leq M$. So we have $$ \begin{aligned} \sum_{i=1}^{59}\left(a_{i}-\frac{m+M}{2}\right)^{2} & =\sum_{i} a_{i}^{2}+59 \cdot\left(\frac{m+M}{2}\right)^{2}-(m+M) \sum_{i} a_{i} \\ & \leq 59 \cdot\left(\frac{M-m}{2}\right)^{2}, \end{aligned} $$ and thus $$ \sum_{i} a_{i}^{2} \leq 59 \cdot\left(\left(\frac{M-m}{2}\right)^{2}-\left(\frac{m+M}{2}\right)^{2}\right)=-59 \cdot m \cdot M=2006 . $$ 3. Prove that for every polynomial $P(x)$ with real coefficients there exist a positive integer $m$ and polynomials $P_{1}(x), P_{2}(x), \ldots, P_{m}(x)$ with real coefficients such that $$ P(x)=\left(P_{1}(x)\right)^{3}+\left(P_{2}(x)\right)^{3}+\cdots+\left(P_{m}(x)\right)^{3} . $$ Solution: We will prove by induction on the degree of $P(x)$ that all polynomials can be represented as a sum of cubes. This is clear for constant polynomials. Now we proceed to the inductive step. It is sufficient to show that if $P(x)$ is a polynomial of degree $n$, then there exist polynomials $Q_{1}(x), Q_{2}(x), \ldots, Q_{r}(x)$ such that the polynomial $$ P(x)-\left(Q_{1}(x)\right)^{3}-\left(Q_{2}(x)\right)^{3}-\cdots-\left(Q_{r}(x)\right)^{3} $$ has degree at most $n-1$. Assume that the coefficient of $x^{n}$ in $P(x)$ is equal to $c$. We consider three cases: If $n=3 k$, we put $r=1, Q_{1}(x)=\sqrt[3]{c} x^{k}$; if $n=3 k+1$ we put $r=3$, $$ Q_{1}(x)=\sqrt[3]{\frac{c}{6}} x^{k}(x-1), \quad Q_{2}(x)=\sqrt[3]{\frac{c}{6}} x^{k}(x+1), \quad Q_{3}(x)=-\sqrt[3]{\frac{c}{3}} x^{k+1} $$ and if $n=3 k+2$ we put $r=2$ and $$ Q_{1}(x)=\sqrt[3]{\frac{c}{3}} x^{k}(x+1), \quad Q_{2}(x)=-\sqrt[3]{\frac{c}{3}} x^{k+1} $$ This completes the induction. 4. Let $a, b, c, d, e, f$ be non-negative real numbers satisfying $a+b+c+d+e+f=6$. Find the maximal possible value of $$ a b c+b c d+c d e+d e f+e f a+f a b $$ and determine all 6-tuples $(a, b, c, d, e, f)$ for which this maximal value is achieved. Answer: 8 . Solution: If we set $a=b=c=2, d=e=f=0$, then the given expression is equal to 8 . We will show that this is the maximal value. Applying the inequality between arithmetic and geometric mean we obtain $$ \begin{aligned} 8 & =\left(\frac{(a+d)+(b+e)+(c+f)}{3}\right)^{3} \geq(a+d)(b+e)(c+f) \\ & =(a b c+b c d+c d e+d e f+e f a+f a b)+(a c e+b d f), \end{aligned} $$ so we see that $a b c+b c d+c d e+d e f+e f a+f a b \leq 8$ and the maximal value 8 is achieved when $a+d=b+e=c+f$ (and then the common value is 2 because $a+b+c+d+$ $e+f=6)$ and $a c e=b d f=0$, which can be written as $(a, b, c, d, e, f)=(a, b, c, 2-a, 2-$ $b, 2-c)$ with $a c(2-b)=b(2-a)(2-c)=0$. From this it follows that $(a, b, c)$ must have one of the forms $(0,0, t),(0, t, 2),(t, 2,2),(2,2, t),(2, t, 0)$ or $(t, 0,0)$. Therefore the maximum is achieved for the 6 -tuples $(a, b, c, d, e, f)=(0,0, t, 2,2,2-t)$, where $0 \leq t \leq 2$, and its cyclic permutations. 5. An occasionally unreliable professor has devoted his last book to a certain binary operation $*$. When this operation is applied to any two integers, the result is again an integer. The operation is known to satisfy the following axioms: (a) $x *(x * y)=y$ for all $x, y \in \mathbb{Z}$; (b) $(x * y) * y=x$ for all $x, y \in \mathbb{Z}$. The professor claims in his book that (C1) the operation $*$ is commutative: $x * y=y * x$ for all $x, y \in \mathbb{Z}$. (C2) the operation $*$ is associative: $(x * y) * z=x *(y * z)$ for all $x, y, z \in \mathbb{Z}$. Which of these claims follow from the stated axioms? Answer: (C1) is true; (C2) is false. Solution: Write $(x, y, z)$ for $x * y=z$. So the axioms can be formulated as $$ \begin{aligned} & (x, y, z) \Longrightarrow(x, z, y) \\ & (x, y, z) \Longrightarrow(z, y, x) . \end{aligned} $$ (C1) is proved by the sequence $(x, y, z) \xrightarrow{(2)}(z, y, x) \xrightarrow{(1)}(z, x, y) \xrightarrow{(2)}(y, x, z)$. A counterexample for (C2) is the operation $x * y=-(x+y)$. 6. Determine the maximal size of a set of positive integers with the following properties: (1) The integers consist of digits from the set $\{1,2,3,4,5,6\}$. (2) No digit occurs more than once in the same integer. (3) The digits in each integer are in increasing order. (4) Any two integers have at least one digit in common (possibly at different positions). (5) There is no digit which appears in all the integers. Answer: 32. Solution: Associate with any $a_{i}$ the set $M_{i}$ of its digits. By (??), (??) and (??) the numbers are uniquely determined by their associated subsets of $\{1,2, \ldots, 6\}$. By (??) the sets are intersecting. Partition the 64 subsets of $\{1,2, \ldots, 6\}$ into 32 pairs of complementary sets $(X,\{1,2, \ldots, 6\}-X)$. Obviously, at most one of the two sets in such a pair can be a $M_{i}$, since the two sets are non-intersecting. Hence, $n \leq 32$. Consider the 22 subsets with at least four elements and the 10 subsets with three elements containing 1 . Hence, $n=32$. 7. A photographer took some pictures at a party with 10 people. Each of the 45 possible pairs of people appears together on exactly one photo, and each photo depicts two or three people. What is the smallest possible number of photos taken? Answer: 19. Solution: Let $x$ be the number of triplet photos (depicting three people, that is, three pairs) and let $y$ be the number of pair photos (depicting two people, that is, one pair). Then $3 x+y=45$. Each person appears with nine other people, and since 9 is odd, each person appears on at least one pair photo. Thus $y \geq 5$, so that $x \leq 13$. The total number of photos is $x+y=45-2 x \geq 45-2 \cdot 13=19$. On the other hand, 19 photos will suffice. We number the persons $0,1, \ldots, 9$, and will proceed to specify 13 triplet photos. We start with making triplets without common pairs of the persons $1-8$ : $$ 123,345,567,781 $$ Think of the persons 1-8 as arranged in order around a circle. Then the persons in each triplet above are separated by at most one person. Next we make triplets containing 0 , avoiding previously mentioned pairs by combining 0 with two people among the persons $1-8$ separated by two persons: $$ 014,085,027,036 $$ Then we make triplets containing 9, again avoiding previously mentioned pairs by combining 9 with the other four possibilities of two people among 1-8 being separated by two persons: $$ 916,925,938,947 $$ Finally, we make our last triplet, again by combining people from 1-8: 246 . Here 2 and 4 , and 4 and 6 , are separated by one person, but those pairs were not accounted for in the first list, whereas 2 and 6 are separated by three persons, and have not been paired before. We now have 13 photos of 39 pairs. The remaining 6 pairs appear on 6 pair photos. Remark: This problem is equivalent to asking how many complete 3-graphs can be packed (without common edges) into a complete 10-graph. 8. The director has found out that six conspiracies have been set up in his department, each of them involving exactly three persons. Prove that the director can split the department in two laboratories so that none of the conspirative groups is entirely in the same laboratory. Solution: Let the department consist of $n$ persons. Clearly $n>4$ (because $\left(\begin{array}{l}4 \\ 3\end{array}\right)<6$ ). If $n=5$, take three persons who do not make a conspiracy and put them in one laboratory, the other two in another. If $n=6$, note that $\left(\begin{array}{l}6 \\ 3\end{array}\right)=20$, so we can find a three-person set such that neither it nor its complement is a conspiracy; this set will form one laboratory. If $n \geq 7$, use induction. We have $\left(\begin{array}{l}n \\ 2\end{array}\right) \geq\left(\begin{array}{l}7 \\ 2\end{array}\right)=21>6 \cdot 3$, so there are two persons $A$ and $B$ who are not together in any conspiracy. Replace $A$ and $B$ by a new person $A B$ and use the inductive hypothesis; then replace $A B$ by initial persons $A$ and $B$. 9. To every vertex of a regular pentagon a real number is assigned. We may perform the following operation repeatedly: we choose two adjacent vertices of the pentagon and replace each of the two numbers assigned to these vertices by their arithmetic mean. Is it always possible to obtain the position in which all five numbers are zeroes, given that in the initial position the sum of all five numbers is equal to zero? Answer: No. Solution: We will show that starting from the numbers $-\frac{1}{5},-\frac{1}{5},-\frac{1}{5},-\frac{1}{5}, \frac{4}{5}$ we cannot get five zeroes. By adding $\frac{1}{5}$ to all vertices we see that our task is equivalent to showing that beginning from numbers $0,0,0,0,1$ and performing the same operations we can never get five numbers $\frac{1}{5}$. This we prove by noticing that in the initial position all the numbers are "binary rational" - that is, of the form $\frac{k}{2^{m}}$, where $k$ is an integer and $m$ is a non-negative integer - and an arithmetic mean of two binary rationals is also such a number, while the number $\frac{1}{5}$ is not of such form. 10. 162 pluses and 144 minuses are placed in a $30 \times 30$ table in such a way that each row and each column contains at most 17 signs. (No cell contains more than one sign.) For every plus we count the number of minuses in its row and for every minus we count the number of pluses in its column. Find the maximum of the sum of these numbers. Answer: $1296=72 \cdot 18$. Solution: In the statement of the problem there are two kinds of numbers: "horizontal" (that has been counted for pluses) and "vertical" (for minuses). We will show that the sum of numbers of each type reaches its maximum on the same configuration. We restrict our attention to the horizontal numbers only. Consider an arbitrary row. Let it contains $p$ pluses and $m$ minuses, $m+p \leq 17$. Then the sum that has been counted for pluses in this row is equal to $m p$. Let us redistribute this sum between all signs in the row. More precisely, let us write the number $m p /(m+p)$ in every nonempty cell in the row. Now the whole "horizontal" sum equals to the sum of all 306 written numbers. Now let us find the maximal possible contribution of each sign in this sum. That is, we ask about maximum of the expression $f(m, p)=m p /(m+p)$ where $m+p \leq 17$. Remark that $f(m, p)$ is an increasing function of $m$. Therefore if $m+p<17$ then increasing of $m$ will also increase the value of $f(m, p)$. Now if $m+p=17$ then $f(m, p)=m(17-m) / 17$ and, obviously, it has maximum $72 / 17$ when $m=8$ or $m=9$. So all the 306 summands in the horizontal sum will be maximal if we find a configuration in which every non-empty row contains 9 pluses and 8 minuses. The similar statement holds for the vertical sum. In order to obtain the desired configuration take a square $18 \times 18$ and draw pluses on 9 generalized diagonals and minuses on 8 other generalized diagonals (the 18th generalized diagonal remains empty). 11. The altitudes of a triangle are 12,15 and 20. What is the area of the triangle? Answer: 150. Solution: Denote the sides of the triangle by $a, b$ and $c$ and its altitudes by $h_{a}, h_{b}$ and $h_{c}$. Then we know that $h_{a}=12, h_{b}=15$ and $h_{c}=20$. By the well known relation $a: b=h_{b}: h_{a}$ it follows $b=\frac{h_{a}}{h_{b}} a=\frac{12}{15} a=\frac{4}{5} a$. Analogously, $c=\frac{h_{a}}{h_{c}} a=\frac{12}{20} a=\frac{3}{5} a$. Thus half of the triangle's circumference is $s=\frac{1}{2}(a+b+c)=\frac{1}{2}\left(a+\frac{4}{5} a+\frac{3}{5} a\right)=\frac{6}{5} a$. For the area $\Delta$ of the triangle we have $\Delta=\frac{1}{2} a h_{a}=\frac{1}{2} a 12=6 a$, and also by the well known Heron formula $\Delta=\sqrt{s(s-a)(s-b)(s-c)}=\sqrt{\frac{6}{5} a \cdot \frac{1}{5} a \cdot \frac{2}{5} a \cdot \frac{3}{5} a}=\sqrt{\frac{6^{2}}{5^{4}} a^{4}}=\frac{6}{25} a^{2}$. Hence, $6 a=\frac{6}{25} a^{2}$, and we get $a=25(b=20, c=15)$ and consequently $\Delta=150$. 12. Let $A B C$ be a triangle, let $B_{1}$ be the midpoint of the side $A B$ and $C_{1}$ the midpoint of the side $A C$. Let $P$ be the point of intersection, other than $A$, of the circumscribed circles around the triangles $A B C_{1}$ and $A B_{1} C$. Let $P_{1}$ be the point of intersection, other than $A$, of the line $A P$ with the circumscribed circle around the triangle $A B_{1} C_{1}$. Prove that $2 A P=3 A P_{1}$. Solution: Since $\angle P B B_{1}=\angle P B A=180^{\circ}-\angle P C_{1} A=\angle P C_{1} C$ and $\angle P C C_{1}=\angle P C A=$ $180^{\circ}-\angle P B_{1} A=\angle P B_{1} B$ it follows that $\triangle P B B_{1}$ is similar to $\triangle P C_{1} C$. Let $B_{2}$ and $C_{2}$ be the midpoints of $B B_{1}$ and $C C_{1}$ respectively. It follows that $\angle B P B_{2}=\angle C_{1} P C_{2}$ and hence $\angle B_{2} P C_{2}=\angle B P C_{1}=180^{\circ}-\angle B A C$, which implies that $A B_{2} P C_{2}$ lie on a circle. By similarity it is now clear that $A P / A P_{1}=A B_{2} / A B_{1}=A C_{2} / A C_{1}=3 / 2$. ![](https://cdn.mathpix.com/cropped/2024_04_17_15c1d4fd3b0f5cc27e92g-5.jpg?height=521&width=740&top_left_y=1096&top_left_x=655) 13. In a triangle $A B C$, points $D, E$ lie on sides $A B, A C$ respectively. The lines $B E$ and $C D$ intersect at $F$. Prove that if $$ B C^{2}=B D \cdot B A+C E \cdot C A, $$ then the points $A, D, F, E$ lie on a circle. Solution: Let $G$ be a point on the segment $B C$ determined by the condition $B G \cdot B C=$ $B D \cdot B A$. (Such a point exists because $B D \cdot B A1$ we have $n^{2} \mid 3^{n}+1$. Let $p$ be the smallest prime divisor of $n$. We have shown that $p>2$. It is also clear that $p \neq 3$, since $3^{n}+1$ is never divisible by 3. Therefore $p \geq 5$. We have $p \mid 3^{n}+1$, so also $p \mid 3^{2 n}-1$. Let $k$ be the smallest positive integer such that $p \mid 3^{k}-1$. Then we have $k \mid 2 n$, but also $k \mid p-1$ by Fermat's theorem. The numbers $3^{1}-1,3^{2}-1$ do not have prime divisors other than 2 , so $p \geq 5$ implies $k \geq 3$. This means that $\operatorname{gcd}(2 n, p-1) \geq k \geq 3$, and therefore $\operatorname{gcd}(n, p-1)>1$, which contradicts the fact that $p$ is the smallest prime divisor of $n$. This completes the proof. 18. For a positive integer $n$ let $a_{n}$ denote the last digit of $n^{\left(n^{n}\right)}$. Prove that the sequence $\left(a_{n}\right)$ is periodic and determine the length of the minimal period. Solution: Let $b_{n}$ and $c_{n}$ denote the last digit of $n$ and $n^{n}$, respectively. Obviously, if $b_{n}=0,1,5,6$, then $c_{n}=0,1,5,6$ and $a_{n}=0,1,5,6$, respectively. If $b_{n}=9$, then $n^{n} \equiv 1(\bmod 2)$ and consequently $a_{n}=9$. If $b_{n}=4$, then $n^{n} \equiv 0$ $(\bmod 2)$ and consequently $a_{n}=6$. If $b_{n}=2,3,7$, or 8 , then the last digits of $n^{m}$ run through the periods: $2-4-8-6$, $3-9-7-1,7-9-3-1$ or $8-4-2-6$, respectively. If $b_{n}=2$ or $b_{n}=8$, then $n^{n} \equiv 0$ $(\bmod 4)$ and $a_{n}=6$. In the remaining cases $b_{n}=3$ or $b_{n}=7$, if $n \equiv \pm 1(\bmod 4)$, then so is $n^{n}$. If $b_{n}=3$, then $n \equiv 3(\bmod 20)$ or $n \equiv 13(\bmod 20)$ and $n^{n} \equiv 7(\bmod 20)$ or $n^{n} \equiv 13$ $(\bmod 20)$, so $a_{n}=7$ or $a_{n}=3$, respectively. If $b_{n}=7$, then $n \equiv 7(\bmod 20)$ or $n \equiv 17(\bmod 20)$ and $n^{n} \equiv 3(\bmod 20)$ or $n^{n} \equiv 17$ $(\bmod 20)$, so $a_{n}=3$ or $a_{n}=7$, respectively. Finally, we conclude that the sequence $\left(a_{n}\right)$ has the following period of length 20: $$ 1-6-7-6-5-6-3-6-9-0-1-6-3-6-5-6-7-6-9-0 $$ 19. Does there exist a sequence $a_{1}, a_{2}, a_{3}, \ldots$ of positive integers such that the sum of every $n$ consecutive elements is divisible by $n^{2}$ for every positive integer $n$ ? Answer: Yes. One such sequence begins 1, 3, 5, 55, 561, 851, 63253, 110055,... Solution: We will show that whenever we have positive integers $a_{1}, \ldots, a_{k}$ such that $n^{2} \mid a_{i+1}+\cdots+a_{i+n}$ for every $n \leq k$ and $i \leq k-n$, then it is possible to choose $a_{k+1}$ such that $n^{2} \mid a_{i+1}+\cdots+a_{i+n}$ for every $n \leq k+1$ and $i \leq k+1-n$. This directly implies the positive answer to the problem because we can start constructing the sequence from any single positive integer. To obtain the necessary property, it is sufficient for $a_{k+1}$ to satisfy $$ a_{k+1} \equiv-\left(a_{k-n+2}+\cdots+a_{k}\right) \quad\left(\bmod n^{2}\right) $$ for every $n \leq k+1$. This is a system of $k+1$ congruences. Note first that, for any prime $p$ and positive integer $l$ such that $p^{l} \leq k+1$, if the congruence with module $p^{2 l}$ is satisfied then also the congruence with module $p^{2(l-1)}$ is satisfied. To see this, group the last $p^{l}$ elements of $a_{1}, \ldots, a_{k+1}$ into $p$ groups of $p^{l-1}$ consecutive elements. By choice of $a_{1}, \ldots, a_{k}$, the sums computed for the first $p-1$ groups are all divisible by $p^{2(l-1)}$. By assumption, the sum of the elements in all $p$ groups is divisible by $p^{2 l}$. Hence the sum of the remaining $p^{l-1}$ elements, that is $a_{k-p^{l-1}+2}+\cdots+a_{k+1}$, is divisible by $p^{2(l-1)}$. Secondly, note that, for any relatively prime positive integers $c, d$ such that $c d \leq k+1$, if the congruences both with module $c^{2}$ and module $d^{2}$ hold then also the congruence with module $(c d)^{2}$ holds. To see this, group the last $c d$ elements of $a_{1}, \ldots, a_{k+1}$ into $d$ groups of $c$ consecutive elements, as well as into $c$ groups of $d$ consecutive elements. Using the choice of $a_{1}, \ldots, a_{k}$ and the assumption together, we get that the sum of the last $c d$ elements of $a_{1}, \ldots, a_{k+1}$ is divisible by both $c^{2}$ and $d^{2}$. Hence this sum is divisible by $(c d)^{2}$. The two observations let us reject all congruences except for the ones with module being the square of a prime power $p^{l}$ such that $p^{l+1}>k+1$. The resulting system has pairwise relatively prime modules and hence possesses a solution by the Chinese Remainder Theorem. 20. A 12-digit positive integer consisting only of digits 1,5 and 9 is divisible by 37. Prove that the sum of its digits is not equal to 76. Solution: Let $N$ be the initial number. Assume that its digit sum is equal to 76 . The key observation is that $3 \cdot 37=111$, and therefore $27 \cdot 37=999$. Thus we have a divisibility test similar to the one for divisibility by 9: for $x=a_{n} 10^{3 n}+a_{n-1} 10^{3(n-1)}+$ $\cdots+a_{1} 10^{3}+a_{0}$, we have $x \equiv a_{n}+a_{n-1}+\cdots+a_{0}(\bmod 37)$. In other words, if we take the digits of $x$ in groups of three and sum these groups, we obtain a number congruent to $x$ modulo 37 . The observation also implies that $A=11111111111$ is divisible by 37 . Therefore the number $N-A$ is divisible by 37 , and since it consists of the digits 0,4 and 8 , it is divisible by 4 . The sum of the digits of $N-A$ equals $76-12=64$. Therefore the number $\frac{1}{4}(N-A)$ contains only the digits $0,1,2$; it is divisible by 37 ; and its digits sum to 16 . Applying our divisibility test to this number, we sum four three-digit groups consisting of the digits $0,1,2$ only. No digits will be carried, and each digit of the sum $S$ is at most 8 . Also $S$ is divisible by 37 , and its digits sum up to 16 . Since $S \equiv 16 \equiv 1(\bmod 3)$ and $37 \equiv 1(\bmod 3)$, we have $S / 37 \equiv 1(\bmod 3)$. Therefore $S=37(3 k+1)$, that is, $S$ is one of $037,148,259,370,481,592,703,814,925$; but each of these either contains the digit 9 or does not have a digit sum of 16 .