## Solutions of Benelux Mathematical Olympiad 2010 Problem 1. A finite set of integers is called bad if its elements add up to 2010. A finite set of integers is a Benelux-set if none of its subsets is bad. Determine the smallest integer $n$ such that the set $\{502,503,504, \ldots, 2009\}$ can be partitioned into $n$ Benelux-sets. (A partition of a set $S$ into $n$ subsets is a collection of $n$ pairwise disjoint subsets of $S$, the union of which equals $S$.) Solution. As $502+1508=2010$, the set $S=\{502,503, \ldots, 2009\}$ is not a Benelux-set, so $n=1$ does not work. We will prove that $n=2$ does work, i.e. that $S$ can be partitioned into 2 Benelux-sets. Define the following subsets of $S$ : $$ \begin{aligned} & A=\{502,503, \ldots, 670\}, \\ & B=\{671,672, \ldots, 1005\}, \\ & C=\{1006,1007, \ldots, 1339\}, \\ & D=\{1340,1341, \ldots, 1508\}, \\ & E=\{1509,1510, \ldots, 2009\} . \end{aligned} $$ We will show that $A \cup C \cup E$ and $B \cup D$ are both Benelux-sets. Note that there does not exist a bad subset of $S$ of one element, since that element would have to be 2010. Also, there does not exist a bad subset of $S$ of more than three elements, since the sum of four or more elements would be at least $502+503+504+505=2014>2010$. So any possible bad subset of $S$ contains two or three elements. Consider a bad subset of two elements $a$ and $b$. As $a, b \geq 502$ and $a+b=2010$, we have $a, b \leq 2010-502=1508$. Furthermore, exactly one of $a$ and $b$ is smaller than 1005 and one is larger than 1005. So one of them, say $a$, is an element of $A \cup B$, and the other is an element of $C \cup D$. Suppose $a \in A$, then $b \geq 2010-670=1340$, so $b \in D$. On the other hand, suppose $a \in B$, then $b \leq 2010-671=1339$, so $b \in C$. Hence $\{a, b\}$ cannot be a subset of $A \cup C \cup E$, nor of $B \cup D$. Now consider a bad subset of three elements $a, b$ and $c$. As $a, b, c \geq 502, a+b+c=2010$, and the three elements are pairwise distinct, we have $a, b, c \leq 2010-502-503=1005$. So $a, b, c \in A \cup B$. At least one of the elements, say $a$, is smaller than $\frac{2010}{3}=670$, and at least one of the elements, say $b$, is larger than 670 . So $a \in A$ and $b \in B$. We conclude that $\{a, b, c\}$ cannot be a subset of $A \cup C \cup E$, nor of $B \cup D$. This proves that $A \cup C \cup E$ and $B \cup D$ are Benelux-sets, and therefore the smallest $n$ for which $S$ can be partitioned into $n$ Benelux-sets is $n=2$. Remark. Observe that $A \cup C \cup E_{1}$ and $B \cup D \cup E_{2}$ are also Benelux-sets, where $\left\{E_{1}, E_{2}\right\}$ is any partition of $E$. Problem 2. Find all polynomials $p(x)$ with real coefficients such that $$ p(a+b-2 c)+p(b+c-2 a)+p(c+a-2 b)=3 p(a-b)+3 p(b-c)+3 p(c-a) $$ for all $a, b, c \in \mathbb{R}$. Solution 1. For $a=b=c$, we have $3 p(0)=9 p(0)$, hence $p(0)=0$. Now set $b=c=0$, then we have $$ p(a)+p(-2 a)+p(a)=3 p(a)+3 p(-a) $$ for all $a \in \mathbb{R}$. So we find a polynomial equation $$ p(-2 x)=p(x)+3 p(-x) $$ Note that the zero polynomial is a solution to this equation. Now suppose that $p$ is not the zero polynomial, and let $n \geq 0$ be the degree of $p$. Let $a_{n} \neq 0$ be the coefficient of $x^{n}$ in $p(x)$. At the left-hand side of (1), the coefficient of $x^{n}$ is $(-2)^{n} \cdot a_{n}$, while at the right-hand side the coefficient of $x^{n}$ is $a_{n}+3 \cdot(-1)^{n} \cdot a_{n}$. Hence $(-2)^{n}=1+3 \cdot(-1)^{n}$. For $n$ even, we find $2^{n}=4$, so $n=2$, and for $n$ odd, we find $-2^{n}=-2$, so $n=1$. As we already know that $p(0)=0$, we must have $p(x)=a_{2} x^{2}+a_{1} x$, where $a_{1}$ and $a_{2}$ are real numbers (possibly zero). The polynomial $p(x)=x$ is a solution to our problem, as $$ (a+b-2 c)+(b+c-2 a)+(c+a-2 b)=0=3(a-b)+3(b-c)+3(c-a) $$ for all $a, b, c \in \mathbb{R}$. Also, $p(x)=x^{2}$ is a solution, since $$ \begin{aligned} (a+b-2 c)^{2}+(b+c-2 a)^{2}+(c+a-2 b)^{2} & =6\left(a^{2}+b^{2}+c^{2}\right)-6(a b+b c+c a) \\ & =3(a-b)^{2}+3(b-c)^{2}+3(c-a)^{2} \end{aligned} $$ for all $a, b, c \in \mathbb{R}$. Now note that if $p(x)$ is a solution to our problem, then so is $\lambda p(x)$ for all $\lambda \in \mathbb{R}$. Also, if $p(x)$ and $q(x)$ are both solutions, then so is $p(x)+q(x)$. We conclude that for all real numbers $a_{2}$ and $a_{1}$ the polynomial $a_{2} x^{2}+a_{1} x$ is a solution. Since we have already shown that there can be no other solutions, these are the only solutions. Solution 2. For $a=b=c$, we have $3 p(0)=9 p(0)$, hence $p(0)=0$. Now set $b=c=0$, then we have $$ p(a)+p(-2 a)+p(a)=3 p(a)+3 p(-a) $$ for all $a \in \mathbb{R}$. So we find a polynomial equation $$ p(-2 x)=p(x)+3 p(-x) $$ Define $q(x)=p(x)+p(-x)$, then we find that $$ q(2 x)=p(2 x)+p(-2 x)=(p(-x)+3 p(x))+(p(x)+3 p(-x))=4 q(x) $$ Note that the zero polynomial is a solution to this equation. Now suppose that $q$ is not the zero polynomial, and let $m \geq 0$ be the degree of $q$. Let $b_{m} \neq 0$ be the coefficient of $x^{m}$ in $q(x)$. At the left-hand side of (3), the coefficient of $x^{m}$ is $2^{m} \cdot b_{m}$, while at the right-hand side the coefficient of $x^{m}$ is $4 b_{m}$. Hence $m=2$. As $q(x)=p(x)+p(-x)$, the polynomial $q(x)$ does not contain any nonzero terms with odd exponent of $x$. Since also $q(0)=2 p(0)=0$, we conclude that $$ q(x)=b_{2} x^{2} $$ where $b_{2}$ is a real number (possibly zero). From (2) we now deduce that $p(2 x)=p(-x)+3 p(x)=2 p(x)+q(x)$, so $$ p(2 x)-2 p(x)=b_{2} x^{2} $$ Suppose that that degree $n$ of $p$ is greater than 2 . Let $a_{n} \neq 0$ be the coefficient of $x^{n}$ in $p(x)$. At the left-hand side of (4), the coefficient of $x^{n}$ is $\left(2^{n}-2\right) \cdot a_{n} \neq 0$. But the coefficient of $x^{n}$ at the right-hand side vanishes, yielding a contradiction. So the degree of $p$ is at most 2 . As we already know that $p(0)=0$, we must have $p(x)=a_{2} x^{2}+a_{1} x$, where $a_{1}$ and $a_{2}$ are real numbers (possibly zero). We finally check that every polynomial of this form is indeed a solution (see solution 1 ). Problem 3. On a line $l$ there are three different points $A, B$ and $P$ in that order. Let $a$ be the line through $A$ perpendicular to $l$, and let $b$ be the line through $B$ perpendicular to $l$. A line through $P$, not coinciding with $l$, intersects $a$ in $Q$ and $b$ in $R$. The line through $A$ perpendicular to $B Q$ intersects $B Q$ in $L$ and $B R$ in $T$. The line through $B$ perpendicular to $A R$ intersects $A R$ in $K$ and $A Q$ in $S$. (a) Prove that $P, T, S$ are collinear. (b) Prove that $P, K, L$ are collinear. ## Solution 1. (a) Since $P, R$ and $Q$ are collinear, we have $\triangle P A Q \sim \triangle P B R$, hence $$ \frac{|A Q|}{|B R|}=\frac{|A P|}{|B P|} $$ Conversely, $P, T$ and $S$ are collinear if it holds that $$ \frac{|A S|}{|B T|}=\frac{|A P|}{|B P|} $$ So it suffices to prove $$ \frac{|B T|}{|B R|}=\frac{|A S|}{|A Q|} $$ Since $\angle A B T=90^{\circ}=\angle A L B$ and $\angle T A B=\angle B A L$, we have $\triangle A B T \sim \triangle A L B$. And since $\angle A L B=90^{\circ}=\angle Q A B$ and $\angle L B A=\angle A B Q$, we have $\triangle A L B \sim \triangle Q A B$. Hence $\triangle A B T \sim \triangle Q A B$, so $$ \frac{|B T|}{|B A|}=\frac{|A B|}{|A Q|} $$ Similarly, we have $\triangle A B R \sim \triangle A K B \sim \triangle S A B$, so $$ \frac{|B R|}{|B A|}=\frac{|A B|}{|A S|} $$ Combining both results, we get $$ \frac{|B T|}{|B R|}=\frac{|B T| /|B A|}{|B R| /|B A|}=\frac{|A B| /|A Q|}{|A B| /|A S|}=\frac{|A S|}{|A Q|} $$ which had to be proved. (b) Let the line $P K$ intersect $B R$ in $B_{1}$ and $A Q$ in $A_{1}$ and let the line $P L$ intersect $B R$ in $B_{2}$ and $A Q$ in $A_{2}$. Consider the points $A_{1}, A$ and $S$ on the line $A Q$, and the points $B_{1}, B$ and $T$ on the line $B R$. As $A Q \| B R$ and the three lines $A_{1} B_{1}, A B$ and $S T$ are concurrent (in $P$ ), we have $$ A_{1} A: A S=B_{1} B: B T $$ where all lengths are directed. Similarly, as $A_{1} B_{1}, A R$ and $S B$ are concurrent (in $K$ ), we have $$ A_{1} A: A S=B_{1} R: R B $$ This gives $$ \frac{B B_{1}}{B T}=\frac{R B_{1}}{R B}=\frac{R B+B B_{1}}{R B}=1+\frac{B B_{1}}{R B}=1-\frac{B B_{1}}{B R} $$ so $$ B B_{1}=\frac{1}{\frac{1}{B T}+\frac{1}{B R}} . $$ Similary, using the lines $A_{2} B_{2}, A B$ and $Q R$ (concurrent in $P$ ) and the lines $A_{2} B_{2}$, $A T$ and $Q B$ (concurrent in $L$ ), we find $$ B_{2} B: B R=A_{2} A: A Q=B_{2} T: T B $$ This gives $$ \frac{B B_{2}}{B R}=\frac{T B_{2}}{T B}=\frac{T B+B B_{2}}{T B}=1+\frac{B B_{2}}{T B}=1-\frac{B B_{2}}{B T} $$ so $$ B B_{2}=\frac{1}{\frac{1}{B R}+\frac{1}{B T}} $$ We conclude that $B_{1}=B_{2}$, which implies that $P, K$ and $L$ are collinear. ## Solution 2. (a) Define $X$ as the intersection of $A T$ and $B S$, and $Y$ as the intersection of $A R$ and $B Q$. To prove that $P, S$ and $T$ are collinear, we will use Menelaos' theorem in $\triangle A B X$, so we have to prove $$ \frac{A P}{P B} \frac{B S}{S X} \frac{X T}{T A}=-1 $$ Note that $B$ is between $P$ and $A, X$ is between $S$ and $B$, and $X$ is between $T$ and $A$, so it suffices to prove that $$ \frac{|A P|}{|P B|} \frac{|B S|}{|S X|} \frac{|X T|}{|T A|}=1 $$ Because $A Q$ and $B R$ are parallel, we have $\triangle A Q P \sim \triangle B R P$, hence $$ \frac{|A P|}{|B P|}=\frac{|Q A|}{|R B|} $$ Also, since $\angle A S B=\angle K B R$ and $\angle B A S=90^{\circ}=\angle B K R$, we have $\triangle A S B \sim$ $\triangle K B R$, hence $$ \frac{|B S|}{|R B|}=\frac{|A S|}{|K B|}, \quad \text { so } \quad|B S|=\frac{|A S|}{|K B|}|R B| \text {. } $$ Similarly, we have $\triangle A T B \sim \triangle Q A L$, hence $$ \frac{|T A|}{|A Q|}=\frac{|T B|}{|A L|}, \quad \text { so } \quad|T A|=\frac{|T B|}{|A L|}|A Q| \text {. } $$ As $\angle A S X=\angle A S B=90^{\circ}-\angle A B S=90^{\circ}-\angle A B K=\angle K A B=\angle Y A B$, and $\angle S A X=90^{\circ}-\angle X A B=90^{\circ}-\angle L A B=\angle A B L=\angle A B Y$, we have $\triangle S X A \sim$ $\triangle A Y B$, hence $$ \frac{|S X|}{|A Y|}=\frac{|A S|}{|B A|}, \quad \text { so } \quad|S X|=\frac{|A S|}{|B A|}|A Y| \text {. } $$ Similarly, we have $\triangle B X T \sim \triangle A Y B$, hence $$ \frac{|X T|}{|Y B|}=\frac{|B T|}{|A B|}, \quad \text { so } \quad|X T|=\frac{|B T|}{|A B|}|Y B| \text {. } $$ By combining (5) - (9), we find $$ \begin{aligned} \frac{|A P|}{|P B|} \frac{|B S|}{|S X|} \frac{|X T|}{|T A|} & =\frac{|Q A|}{|R B|} \cdot \frac{|A S|}{|K B|}|R B| \cdot \frac{|B A|}{|A S||A Y|} \cdot \frac{|B T|}{|A B|}|Y B| \cdot \frac{|A L|}{|T B||A Q|} \\ & =\frac{|A L|}{|K B|} \frac{|Y B|}{|A Y|} . \end{aligned} $$ Since $\angle Y L A=90^{\circ}=\angle Y K B$ and $\angle A Y L=\angle B Y K$, we have $\triangle A Y L \sim \triangle B Y K$, hence $$ \frac{|A L|}{|B K|}=\frac{|A Y|}{|B Y|}, \quad \text { so } \quad \frac{|A L|}{|B K|} \frac{|B Y|}{|A Y|}=1 $$ By combining (10) and (11), we find $$ \frac{|A P|}{|P B|} \frac{|B S|}{|S X|} \frac{|X T|}{|T A|}=1, $$ as we wanted to prove. (b) Again, we will use Menelaos' theorem in $\triangle A B X$, so we have to prove $$ \frac{A P}{P B} \frac{B K}{K X} \frac{X L}{L A}=-1 $$ Note that $\frac{A P}{P B}<0$, and $\frac{B K}{K X}<0$ if and only if $\frac{X L}{L A}<0$, so it suffices to prove that $$ \frac{|A P|}{|P B|} \frac{|B K|}{|K X|} \frac{|X L|}{|L A|}=1 $$ As $\angle B X L=\angle A X K$ and $\angle B L X=90^{\circ}=\angle A K X$, we have $\triangle B L X \sim \triangle A K X$, hence $$ \frac{|X L|}{|X K|}=\frac{|B L|}{|A K|} $$ Since $\angle A L B=90^{\circ}=\angle Q A B$, we have $\triangle A L B \sim \triangle Q A B$, hence $$ \frac{|L A|}{|A Q|}=\frac{|L B|}{|A B|}, \quad \text { so } \quad|L A|=\frac{|L B|}{|A B|}|A Q| \text {. } $$ Similarly, we have $\triangle A K B \sim \triangle A B R$, hence $$ \frac{|B K|}{|R B|}=\frac{|A K|}{|A B|}, \quad \text { so } \quad|B K|=\frac{|A K|}{|A B|}|R B| $$ By combining (5) and (12) - (14), we find $$ \left.\frac{|A P|}{|P B|}\left|\frac{|B K|}{|K X|} \frac{|X L|}{|L A|}=\frac{|Q A|}{|R B|} \cdot \frac{|B L|}{|A K|} \cdot \frac{|A B|}{|L B||A Q|} \cdot \frac{|A K|}{|A B|}\right| R B \right\rvert\,=1, $$ which is what we wanted to prove. Solution 3. As $\angle A K B=\angle A L B=90^{\circ}$, the points $K$ and $L$ belong to the circle with diameter $A B$. Since $\angle Q A B=\angle A B R=90^{\circ}$, the lines $A Q$ and $B R$ are tangents to this circle. Apply Pascal's theorem to the points $A, A, K, L, B$ and $B$, all on the same circle. This yields that the intersection $Q$ of the tangent in $A$ and the line $B L$, the intersection $R$ of the tangent in $B$ and the line $A K$, and the intersection of $K L$ and $A B$ are collinear. So $K L$ passes through the intersection of $A B$ and $Q R$, which is point $P$. Hence $P, K$ and $L$ are collinear. This proves part b. Now apply Pascal's theorem to the points $A, A, L, K, B$ and $B$. This yields that the intersection $S$ of the tangent in $A$ and the line $B K$, the intersection $T$ of the tangent in $B$ and the line $A L$, and the intersection $P$ of $K L$ and $A B$ are collinear. This proves part a. ## Solution 4. (a) W.l.o.g. we may assume that $A=(0,0)$ and $B=(1,0)$ and the line through $P$ is in the upper half plane, so $l$ is the $x$-axis, $a$ is the $y$-axis and $b$ is the line $x=1$. Take $P=(p, 0)(p>1)$ and $Q=(0, q)(q>0)$. Since $P Q$ is given by $\frac{x}{p}+\frac{y}{q}=1$, we find $R=\left(1, \frac{q(p-1)}{p}\right)$. Now $A R$ is given by $y=\frac{q(p-1)}{p} x$, hence $B S$, the line perpendicular to $A R$ and passing through $B=(1,0)$, is given by $y=-\frac{p}{q(p-1)}(x-1)$. We find $S=\left(0, \frac{p}{q(p-1)}\right)$. Moreover $B Q$ is given by $y=-q(x-1)$, hence $A T$, the line perpendicular to $B Q$ and passing through $A=(0,0)$, is given by $y=\frac{1}{q} x$. We find $T=\left(1, \frac{1}{q}\right)$. Since $\frac{|B T|}{|B P|}=\frac{1 / q}{p-1}=\frac{\frac{p}{q(p-1)}}{p}=\frac{|A S|}{|A P|}$, we conclude that $P, T$ and $S$ are collinear. (b) Point $K$ is the intersection of $A R$ and $B S$. Solving for $x$ yields $$ \begin{aligned} \frac{q(p-1)}{p} x & =-\frac{p}{q(p-1)}(x-1) \\ \left(\frac{q(p-1)}{p}+\frac{p}{q(p-1)}\right) x & =\frac{p}{q(p-1)} \\ x & =\frac{\frac{p}{q(p-1)}}{\frac{q(p-1)}{p}+\frac{p}{q(p-1)}} \end{aligned} $$ so $$ K=\left(\frac{\frac{p}{q(p-1)}}{\frac{q(p-1)}{p}+\frac{p}{q(p-1)}}, \frac{1}{\frac{q(p-1)}{p}+\frac{p}{q(p-1)}}\right) $$ Point $L$ is the point of intersection of $A T$ and $B Q$. Solving for $x$ yields $$ \begin{aligned} \frac{1}{q} x & =-q(x-1) \\ \left(\frac{1}{q}+q\right) x & =q \\ x & =\frac{q}{\frac{1}{q}+q} \end{aligned} $$ so $$ L=\left(\frac{q}{\frac{1}{q}+q}, \frac{1}{\frac{1}{q}+q}\right) $$ Let $K_{0}$ and $L_{0}$ be the projections of $K$ and $L$ on the $x$-axis. We have to show that the following fractions are equal: $$ \frac{\left|K_{0} K\right|}{\left|K_{0} P\right|}=\frac{\frac{1}{\frac{q(p-1)}{p}+\frac{p}{q(p-1)}}}{p-\frac{\frac{p}{q-1)}}{\frac{q(p-1)}{p}+\frac{p}{q(p-1)}}} \quad \text { and } \quad \frac{\left|L_{0} L\right|}{\left|L_{0} P\right|}=\frac{\frac{1}{\frac{1}{q}+q}}{p-\frac{q}{\frac{1}{q}+q}} $$ Working out cross products twice, this comes down to $$ \begin{aligned} \frac{1}{\frac{q(p-1)}{p}+\frac{p}{q(p-1)}} \cdot\left(p-\frac{q}{\frac{1}{q}+q}\right) & \stackrel{?}{=} \frac{1}{\frac{1}{q}+q} \cdot\left(p-\frac{\frac{p}{q(p-1)}}{\frac{q(p-1)}{p}+\frac{p}{q(p-1)}}\right) \\ \left(\frac{1}{q}+q\right) \cdot\left(p-\frac{q}{\frac{1}{q}+q}\right) & \stackrel{?}{=}\left(\frac{q(p-1)}{p}+\frac{p}{q(p-1)}\right) \cdot\left(p-\frac{\frac{p}{q(p-1)}}{\frac{q(p-1)}{p}+\frac{p}{q(p-1)}}\right) \\ \frac{p}{q}+p q-q & \stackrel{?}{=} q(p-1)+\frac{p^{2}}{q(p-1)}-\frac{p}{q(p-1)} \\ \frac{p}{q}+p q-q & \stackrel{?}{=} q(p-1)+\frac{p(p-1)}{q(p-1)} \end{aligned} $$ which is clearly true. Problem 4. Find all quadruples $(a, b, p, n)$ of positive integers, such that $p$ is a prime and $$ a^{3}+b^{3}=p^{n} $$ Solution 1. Let $(a, b, p, n)$ be a solution. Note that we can write the given equation as $$ (a+b)\left(a^{2}-a b+b^{2}\right)=p^{n} $$ As $a$ and $b$ are positive integers, we have $a+b \geq 2$, so $p \mid a+b$. Furthermore, $a^{2}-a b+b^{2}=$ $(a-b)^{2}+a b$, so either $a=b=1$ or $a^{2}-a b+b^{2} \geq 2$. Assume that the latter is the case. Then $p$ is a divisor of both $a+b$ and $a^{2}-a b+b^{2}$, hence also of $(a+b)^{2}-\left(a^{2}-a b+b^{2}\right)=3 a b$. This means that $p$ either is equal to 3 or is a divisor of $a b$. Since $p$ is a divisor of $a+b$, we have $p|a \Leftrightarrow p| b$, hence either $p=3$, or $p \mid a$ and $p \mid b$. If $p \mid a$ and $p \mid b$, then we can write $a=p a^{\prime}, b=p b^{\prime}$ with $a^{\prime}$ and $b^{\prime}$ positive integers, and we have $\left(a^{\prime}\right)^{3}+\left(b^{\prime}\right)^{3}=p^{n-3}$, so $\left(a^{\prime}, b^{\prime}, p, n-3\right)$ then is another solution (note that $\left(a^{\prime}\right)^{3}+\left(b^{\prime}\right)^{3}$ is a positive integer greater than 1 , so $n-3$ is positive). Now assume that $\left(a_{0}, b_{0}, p_{0}, n_{0}\right)$ is a solution such that $p \nmid a$. From the reasoning above it follows that either $a_{0}=b_{0}=1$, or $p_{0}=3$. After all, if we do not have $a_{0}=b_{0}=1$ and we have $p_{0} \neq 3$, then $p \mid a$. Also, given an arbitrary solution $(a, b, p, n)$, we can divide everything by $p$ repeatedly until there are no factors $p$ left in $a$. Suppose $a_{0}=b_{0}=1$. Then the solution is $(1,1,2,1)$. Suppose $p_{0}=3$. Assume that $3^{2} \mid\left(a_{0}^{2}-a_{0} b_{0}+b_{0}^{2}\right)$. As $3^{2} \mid\left(a_{0}+b_{0}\right)^{2}$, we then have $3^{2} \mid\left(a_{0}+b_{0}\right)^{2}-\left(a_{0}^{2}-a_{0} b_{0}+b_{0}^{2}\right)=3 a_{0} b_{0}$, so $3 \mid a_{0} b_{0}$. But $3 \nmid a_{0}$ by assumption, and $3 \mid a_{0}+b_{0}$, so $3 \nmid b_{0}$, which contradicts $3 \mid a_{0} b_{0}$. We conclude that $3^{2} \nmid\left(a_{0}^{2}-a_{0} b_{0}+b_{0}^{2}\right)$. As both $a_{0}+b_{0}$ and $a_{0}^{2}-a_{0} b_{0}+b_{0}^{2}$ must be powers of 3 , we have $a_{0}^{2}-a_{0} b_{0}+b_{0}^{2}=3$. Hence $\left(a_{0}-b_{0}\right)^{2}+a_{0} b_{0}=3$. We must have $\left(a_{0}-b_{0}\right)^{2}=0$ or $\left(a_{0}-b_{0}\right)^{2}=1$. The former does not give a solution; the latter gives $a_{0}=2$ and $b_{0}=1$ or $a_{0}=1$ and $b_{0}=2$. So all solutions with $p \nmid a$ are $(1,1,2,1),(2,1,3,2)$ and $(1,2,3,2)$. From the above it follows that all other solutions are of the form $\left(p_{0}^{k} a_{0}, p_{0}^{k} b_{0}, p_{0}, n_{0}+3 k\right)$, where $\left(a_{0}, b_{0}, p_{0}, n_{0}\right)$ is one of these three solutions. Hence we find three families of solutions: - $\left(2^{k}, 2^{k}, 2,3 k+1\right)$ with $k \in \mathbb{Z}_{\geq 0}$, - $\left(2 \cdot 3^{k}, 3^{k}, 3,3 k+2\right)$ with $k \in \mathbb{Z}_{\geq 0}$, - $\left(3^{k}, 2 \cdot 3^{k}, 3,3 k+2\right)$ with $k \in \mathbb{Z}_{\geq 0}$. It is easy to check that all these quadruples are indeed solutions. Solution 2. Let $(a, b, p, n)$ be a solution. Note that we can write the given equation as $$ (a+b)\left(a^{2}-a b+b^{2}\right)=p^{n} $$ As $a$ and $b$ are positive integers, we have $a+b \geq 2$ and $a^{2}-a b+b^{2}=(a-b)^{2}+a b \geq 1$. So both factors are positive and therefore must be powers of $p$. Let $k$ be an integer with $1 \leq k \leq n$ such that $a+b=p^{k}$. Then $a^{2}-a b+b^{2}=p^{n-k}$. If we substitute $b=p^{k}-a$, we find $$ p^{n-k}=(a+b)^{2}-3 a b=p^{2 k}-3 a\left(p^{k}-a\right) . $$ We can rewrite this as: $$ 3 a^{2}-3 p^{k} a+p^{2 k}-p^{n-k}=0 $$ from which we see that $a$ is a solution of the following quadratic equation in $x$ : $$ 3 x^{2}-3 p^{k} x+p^{2 k}-p^{n-k}=0 . $$ The discriminant of (15) is $$ D=\left(-3 p^{k}\right)^{2}-4 \cdot 3 \cdot\left(p^{2 k}-p^{n-k}\right)=3 \cdot\left(4 p^{n-k}-p^{2 k}\right)=3 p^{n-k} \cdot\left(4-p^{3 k-n}\right) $$ As $p^{n-k}=(a+b)^{2}-3 a b<(a+b)^{2}=p^{2 k}$, we have $n-k<2 k$, so $3 k-n>0$. Since $a$ is a solution of (15), the discriminant must be nonnegative. Hence $4-p^{3 k-n} \geq 0$. If $p=2$, this implies $3 k-n=1$ or $3 k-n=2$; if $p=3$, this implies $3 k-n=1$; and if $p>3$, then $p \geq 5$ so $4 \geq p^{3 k-n}$ can never be true. Suppose $p=2$ and $3 k-n=1$. Then $D=3 \cdot 2^{2 k-1} \cdot(4-2)=3 \cdot 2^{2 k}$. But this is a not a square, so the solutions of (15) will not be integers, which yields a contradiction. Suppose $p=2$ and $3 k-n=2$. Then $D=3 \cdot 2^{2 k-2} \cdot(4-4)=0$, so the only solution of (15) is $x=\frac{3 \cdot 2^{k}}{2 \cdot 3}=2^{k-1}$. Therefore $a=2^{k-1}$ and $b=2^{k}-a=2^{k-1}$, and this gives a solution for all $k \geq 1$, namely ( $\left.2^{k-1}, 2^{k-1}, 2,3 k-2\right)$. Suppose $p=3$ and $3 k-n=1$. Then $D=3 \cdot 3^{2 k-1} \cdot(4-3)=3^{2 k}$, so the solutions of (15) are $x=\frac{3^{k+1} \pm 3^{k}}{2 \cdot 3}=\frac{1}{2}\left(3^{k} \pm 3^{k-1}\right)$. Therefore $a=2 \cdot 3^{k-1}$ or $a=3^{k-1}$. For all $k \geq 1$ we find the solutions $\left(2 \cdot 3^{k-1}, 3^{k-1}, 3,3 k-1\right)$ and $\left(3^{k-1}, 2 \cdot 3^{k-1}, 3,3 k-1\right)$. We conclude that there are three families of solutions: - $\left(2^{k-1}, 2^{k-1}, 2,3 k-2\right)$ with $k \in \mathbb{Z}_{\geq 1}$, - $\left(2 \cdot 3^{k-1}, 3^{k-1}, 3,3 k-1\right)$ with $k \in \mathbb{Z}_{\geq 1}$, - $\left(3^{k-1}, 2 \cdot 3^{k-1}, 3,3 k-1\right)$ with $k \in \mathbb{Z}_{\geq 1}$. It is easy to check that all these quadruples are indeed solutions.