# JBMO 2022 - Solutions Problem 1. Find all pairs $(a, b)$ of positive integers such that $$ 11 a b \leq a^{3}-b^{3} \leq 12 a b $$ Solution 1. Let $a-b=t$. Due to $a^{3}-b^{3} \geq 11 a b$ we conclude that $a>b$ so $t$ is a positive integer and the condition can be written as $$ 11 b(b+t) \leq t\left[b^{2}+b(b+t)+(b+t)^{2}\right] \leq 12 b(b+t) $$ Since $$ t\left[b^{2}+b(b+t)+(b+t)^{2}\right]=t\left(b^{2}+b^{2}+b t+b^{2}+2 b t+t^{2}\right)=3 t b(b+t)+t^{3} $$ the condition can be rewritten as $$ (11-3 t) b(b+t) \leq t^{3} \leq(12-3 t) b(b+t) $$ We can not have $t \geq 4$ since in that case $t^{3} \leq(12-3 t) b(b+t)$ is not satisfied as the right hand side is not positive. Therefore it remains to check the cases when $t \in\{1,2,3\}$. If $t=3$, the above condition becomes $$ 2 b(b+3) \leq 27 \leq 3 b(b+3) $$ If $b \geq 3$, the left hand side is greater than 27 and if $b=1$ the right hand side is smaller than 27 so there are no solutions in these cases. If $b=2$, we get a solution $(a, b)=(5,2)$. If $t \leq 2$, we have $$ (11-3 t) b(b+t) \geq(11-6) \cdot 1 \cdot(1+1)=10>t^{3} $$ so there are no solutions in this case. In summary, the only solution is $(a, b)=(5,2)$. Solution 2. First, from $a^{3}-b^{3} \geq 11 a b>0$ it follows that $a>b$, implying that $a-b \geq 1$. Note that $$ a^{3}-b^{3}=(a-b)\left(a^{2}+a b+b^{2}\right)=(a-b)\left[(a-b)^{2}+3 a b\right] \geq(a-b)(1+3 a b)>3 a b(a-b) $$ Therefore $12 a b \geq a^{3}-b^{3}>3 a b(a-b)$, which implies that $a-b<4$ so $a-b \in\{1,2,3\}$. We discuss three possible cases: - $a-b=1$ After replacing $a=b+1$, the condition $a^{3}-b^{3} \geq 11 a b$ reduces to $1 \geq 8 b^{2}+8 b$, which is not satisfied for any positive integer $b$. - $a-b=2$ After replacing $a=b+2$, the condition $a^{3}-b^{3} \geq 11 a b$ reduces to $8 \geq 5 b^{2}+10 b$, which is also not satisfied for any positive integer $b$. - $a-b=3$ After replacing $a=b+3$, the condition $a^{3}-b^{3} \geq 11 a b$ reduces to $27 \geq 2 b^{2}+6 b$. The last inequality holds true only for $b=1$ and $b=2$. For $b=1$ we get $a=4$ and for $b=2$ we get $a=5$. Direct verification shows that $a^{3}-b^{3} \leq 12 a b$ is satisfied only for $(a, b)=(5,2)$. In summary, $(a, b)=(5,2)$ is the only pair of positive integers satisfying all conditions of the problem. Problem 2. Let $A B C$ be an acute triangle such that $A H=H D$, where $H$ is the orthocenter of $A B C$ and $D \in B C$ is the foot of the altitude from the vertex $A$. Let $\ell$ denote the line through $H$ which is tangent to the circumcircle of the triangle $B H C$. Let $S$ and $T$ be the intersection points of $\ell$ with $A B$ and $A C$, respectively. Denote the midpoints of $B H$ and $C H$ by $M$ and $N$, respectively. Prove that the lines $S M$ and $T N$ are parallel. Solution 1. In order to prove that $S M$ and $T N$ are parallel, it suffices to prove that both of them are perpendicular to $S T$. Due to symmetry, we will provide a detailed proof of $S M \perp S T$, whereas the proof of $T N \perp S T$ is analogous. In this solution we will use the following notation: $\angle B A C=\alpha, \angle A B C=\beta, \angle A C B=\gamma$. ![](https://cdn.mathpix.com/cropped/2024_06_05_6dbeb2bed8a94e31d91eg-3.jpg?height=1047&width=1489&top_left_y=913&top_left_x=318) We first observe that, due to the tangency condition, we have $$ \angle S H B=\angle H C B=90^{\circ}-\beta $$ Combining the above with $$ \angle S B H=\angle A B H=90^{\circ}-\alpha $$ we get $$ \angle B S H=180^{\circ}-\left(90^{\circ}-\beta\right)-\left(90^{\circ}-\alpha\right)=\alpha+\beta=180^{\circ}-\gamma $$ from which it follows that $\angle A S T=\gamma$. Since $A H=H D, H$ is the midpoint of $A D$. If $K$ denotes the midpoint of $A B$, we have that $K H$ and $B C$ are parallel. Since $M$ is the midpoint of $B H$, the lines $K M$ and $A D$ are parallel, from which it follows that $K M$ is perpendicular to $B C$. As $K H$ and $B C$ are parallel, we have that $K M$ is perpendicular to $K H$ so $\angle M K H=90^{\circ}$. Using the parallel lines $K H$ and $B C$ we also have $$ \angle K H M=\angle K H B=\angle H B C $$ Now, $$ \angle H M K=90^{\circ}-\angle K H M=90^{\circ}-\angle H B C=90^{\circ}-\left(90^{\circ}-\gamma\right)=\gamma=\angle A S T=\angle K S H $$ so the quadrilateral $M S K H$ is cyclic, which implies that $\angle M S H=\angle M K H=90^{\circ}$. In other words, the lines $S M$ and $S T$ are perpendicular, which completes our proof. Solution 2. We will refer to the same figure as in the first solution. Since $C H$ is tangent to the circumcircle of triangle $B H C$, we have $$ \angle S H B=\angle H C B=90^{\circ}-\angle A B C=\angle H A B $$ From the above it follows that triangles $A H B$ and $H S B$ are similar. If $K$ denotes the midpoint of $A B$, then triangles $A H K$ and $H S M$ are also similar. Now, observe that $H$ and $K$ are respectively the midpoints of $A D$ and $A B$, which implies that $H K \| D B$, so $$ \angle A H K=\angle A D B=90^{\circ} $$ Now, from the last observation and the similarity of triangles $A H K$ and $H S M$, it follows that $$ \angle H S M=\angle A H K=90^{\circ} $$ Due to symmetry, analogously as above, we can prove that $\angle H T N=90^{\circ}$, implying that both $S M$ and $T N$ are perpendicular to $T S$, hence they are parallel. Problem 3. Find all quadruples of positive integers $(p, q, a, b)$, where $p$ and $q$ are prime numbers and $a>1$, such that $$ p^{a}=1+5 q^{b} $$ Solution 1. First of all, observe that if $p, q$ are both odd, then the left hand side of the given equation is odd and the right hand side is even so there are no solutions in this case. In other words, one of these numbers has to be equal to 2 so we can discuss the following two cases: - $p=2$ In this case the given equation becomes $$ 2^{a}=1+5 \cdot q^{b} $$ Note that $q$ has to be odd. In addition, $2^{a} \equiv 1(\bmod 5)$. It can be easily shown that the last equation holds if and only if $a=4 c$, for some positive integer $c$. Now, our equation becomes $2^{4 c}-1=5 \cdot q^{b}$, which can be written into its equivalent form $$ \left(4^{c}-1\right)\left(4^{c}+1\right)=5 \cdot q^{b} $$ Since $q$ is odd, it can not divide both $4^{c}-1$ and $4^{c}+1$. Namely, if it divides both of these numbers then it also divides their difference, which is equal to 2 , and this is clearly impossible. Therefore, we have that either $q^{b} \mid 4^{c}-1$ or $q^{b} \mid 4^{c}+1$, which implies that one of the numbers $4^{c}-1$ and $4^{c}+1$ divides 5 . Since for $c \geq 2$ both of these numbers are greater than 5 , we only need to discuss the case $c=1$. But in this case $5 \cdot q^{b}=15$, which is obviously satisfied only for $b=1$ and $q=3$. In summary, $(p, q, a, b)=(2,3,4,1)$ is the only solution in this case. - $q=2$ In this case obviously $p$ must be an odd number and the given equation becomes $$ p^{a}=1+5 \cdot 2^{b} $$ First, assume that $b$ is even. Then $2^{b} \equiv 1(\bmod 3)$, which implies that $1+5 \cdot 2^{b}$ is divisible by 3 , hence $3 \mid p^{a}$ so $p$ must be equal to 3 and our equation becomes $$ 3^{a}=1+5 \cdot 2^{b} $$ From here it follows that $3^{a} \equiv 1(\bmod 5)$, which implies that $a=4 c$, for some positive integer $c$. Then the equation $3^{a}=1+5 \cdot 2^{b}$ can be written into its equivalent form $$ \frac{3^{2 c}-1}{2} \cdot \frac{3^{2 c}+1}{2}=5 \cdot 2^{b-2} $$ Observe now that $3^{2 c} \equiv 1(\bmod 4)$ from where it follows that $\frac{3^{2 c}+1}{2} \equiv 1(\bmod 2)$. From here we can conclude that the number is $\frac{3^{2 c}+1}{2}$ is relatively prime to $2^{b-2}$, so it has to divide 5. Clearly, this is possible only for $c=1$ since for $c>1$ we have $\frac{3^{2 c}+1}{2}>5$. For $c=1$, we easily find $b=4$, which yields the solution $(p, q, a, b)=(3,2,4,4)$. Next, we discuss the case when $b$ is odd. In this case, $$ p^{a}=1+5 \cdot 2^{b} \equiv 1+5 \cdot 2 \equiv 2(\bmod 3) $$ The last equation implies that $a$ must be odd. Namely, if $a$ is even then we can not have $p^{a} \equiv 2(\bmod 3)$ regardless of the value of $p$. Combined with the condition $a>1$, we conclude that $a \geq 3$. The equation $p^{a}=1+5 \cdot 2^{b}$ can be written as $$ 5 \cdot 2^{b}=p^{a}-1=(p-1)\left(p^{a-1}+p^{a-2}+\cdots+1\right) $$ Observe that $$ p^{a-1}+p^{a-2}+\cdots+1 \equiv 1+1+\cdots+1=a \equiv 1(\bmod 2) $$ so this number is relatively prime to $2^{b}$, which means that it has to divide 5 . But this is impossible, since $a \geq 3$ and $p \geq 3$ imply that $$ p^{a-1}+p^{a-2}+\cdots+1 \geq p^{2}+p+1 \geq 3^{2}+3+1=13>5 $$ In other words, there are no solutions when $q=2$ and $b$ is an even number. In summary, $(a, b, p, q)=(4,4,3,2)$ and $(a, b, p, q)=(4,1,2,3)$ are the only solutions. Solution 2. Analogously as in the first solution we conclude that at least one of the numbers $p$ and $q$ has to be even. Since these numbers are prime, this implies that at least one of $p$ and $q$ must be equal to 2 . Therefore it is sufficient to discuss the following two cases: - $p=2$ In this case the given equation then becomes $$ 2^{a}=1+5 \cdot q^{b} $$ From here, it follows that $q$ is an odd number. In addition, $2^{a} \equiv 1(\bmod 5)$, which implies that $a=4 c$, for some positive integer $c$. Then the above equation can be written in its equivalent form $$ \left(2^{c}-1\right)\left(2^{c}+1\right)\left(2^{2 c}+1\right)=5 \cdot q^{b} $$ Since $2^{c}-1,2^{c}$ and $2^{c}+1$ are three consecutive integers, one of them must be divisible by 3. Clearly it is not $2^{c}$ implying that one of the numbers $2^{c}-1$ and $2^{c}+1$ is divisible by 3 . This implies that $3 \mid\left(2^{c}-1\right)\left(2^{c}+1\right)\left(2^{2 c}+1\right)$ so $3 \mid 5 \cdot q^{b}$, hence $q$ must be equal to 3 and we are left with solving the equation $$ \left(2^{c}-1\right)\left(2^{c}+1\right)\left(2^{2 c}+1\right)=5 \cdot 3^{b} $$ Note that $2^{2 c}+1 \equiv 2(\bmod 3)$ so from the above equation it follows that $2^{2 c}+1$ must be equal to 5 , which implies that $c=1$. For $c=1$ we have $b=1$, so we get $(a, b, p, q)=(4,1,2,3)$ as the only solution in this case. - $q=2$ In this case the given equation becomes $$ p^{a}=1+5 \cdot 2^{b} $$ so clearly $p$ must be an odd number. If $a$ is odd then we have $$ 5 \cdot 2^{b}=(p-1)\left(p^{a-1}+p^{a-2}+\cdots+p+1\right) $$ The second bracket on the right hand side is sum of $a$ odd numbers so it is an odd number. Due to the condition $a>1$ we must have $a \geq 3$. But then $$ p^{a-1}+p^{a-2}+\cdots+p+1 \geq p^{2}+p+1 \geq 3^{2}+3+1>5 $$ so we do not have solutions in this case. Therefore it remains to discuss the case when $a$ is even. Let $a=2 c$ for some positive integer $c$. Then we have the following equation $$ \left(p^{c}-1\right)\left(p^{c}+1\right)=5 \cdot 2^{b} $$ Note that $p^{c}-1$ and $p^{c}+1$ are two consecutive even numbers so one of them is divisible by 2 but not by 4 . Looking into the right hand side of the above equation, we conclude that this number must be equal to either 2 or $5 \cdot 2=10$. In other words, either $p^{c}-1 \in\{2,10\}$ or $p^{c}+1 \in\{2,10\}$ yielding the following possible values for $p^{c}$ : $1,3,9,11$. Clearly $p^{c}=1$ is impossible, whereas $p^{c}=3$ implies that $\left(p^{c}-1\right)\left(p^{c}+1\right)$ is not divisible by 5 so there are no solutions if $p^{c}=3$. Similarly, for $p^{c}=11$ we have that $\left(p^{c}-1\right)\left(p^{c}+1\right)$ is divisible by 3 so it can not be equal to $5 \cdot 2^{b}$ for any positive integer $b$. Finally, if $p^{c}=9$, we have solution $(a, b, p, q)=(4,4,3,2)$. In summary, $(a, b, p, q)=(4,4,3,2)$ and $(a, b, p, q)=(4,1,2,3)$ are the only solutions. Problem 4. We call an even positive integer $n$ nice if the set $\{1,2, \ldots, n\}$ can be partitioned into $\frac{n}{2}$ two-element subsets, such that the sum of the elements in each subset is a power of 3 . For example, 6 is nice, because the set $\{1,2,3,4,5,6\}$ can be partitioned into subsets $\{1,2\},\{3,6\},\{4,5\}$. Find the number of nice positive integers which are smaller than $3^{2022}$. Solution. For a nice number $n$ and a given partition of the set $\{1,2, \ldots, n\}$ into twoelement subsets such that the sum of the elements in each subset is a power of 3 , we say that $a, b \in\{1,2, \ldots, n\}$ are paired if both of them belong to the same subset. Let $x$ be a nice number and $k$ be a (unique) non-negative integer such that $3^{k} \leq x<3^{k+1}$. Suppose that $x$ is paired with $y3^{k} $$ implies that $s>k$. From these we conclude that $s$ must be equal to $k+1$, so $x+y=3^{k+1}$. The last equation, combined with $x>y$, implies that $x>\frac{3^{k+1}}{2}$. Similarly as above, we can conclude that each number $z$ from the closed interval $\left[3^{k+1}-x, x\right]$ is paired with $3^{k+1}-z$. Namely, for any such $z$, the larger of the numbers $z$ and $3^{k+1}-z$ is greater than $\frac{3^{k+1}}{2}$ which is greater than $3^{k}$, so the numbers $z$ and $3^{k+1}-z$ must necessarily be in the same subset. In other words, each number from the interval $\left[3^{k+1}-x, x\right]$ is paired with another number from this interval. Note that this implies that all numbers smaller than $3^{k+1}-x$ are paired among themselves, so the number $3^{k+1}-x-1$ is either nice or equals zero. Also, the number $3^{k}$ must be paired with $2 \cdot 3^{k}$, so $x \geq 2 \cdot 3^{k}$. Finally, we prove by induction that $a_{n}=2^{n}-1$, where $a_{n}$ is the number of nice positive integers smaller than $3^{n}$. For $n=1$, the claim is obviously true, because 2 is the only nice positive integer smaller than 3 . Now, assume that $a_{n}=2^{n}-1$ for some positive integer $n$. We will prove that $a_{n+1}=2^{n+1}-1$. To prove this, first observe that the number of nice positive integers between $2 \cdot 3^{n}$ and $3^{n+1}$ is exactly $a_{n+1}-a_{n}$. Next, observe that $3^{n+1}-1$ is nice. For every nice number $2 \cdot 3^{n} \leq x<3^{n+1}-1$, the number $3^{n+1}-x-1$ is also nice and is strictly smaller than $3^{n}$. Also, for every positive integer $y<3^{n}$, obviously there is a unique number $x$ such that $2 \cdot 3^{n} \leq x<3^{n+1}-1$ and $3^{n+1}-x-1=y$. Thus, $$ a_{n+1}-a_{n}=a_{n}+1 \Leftrightarrow a_{n+1}=2 a_{n}+1=2\left(2^{n}-1\right)+1=2^{n+1}-1 $$ completing the proof. In summary, there are $2^{2022}-1$ nice positive integers smaller than $3^{2022}$.