Task 2. Determine all positive integers $n$ for which there exist positive integers $a_{1}, a_{2}, \ldots, a_{n}$ such that

$$
a_{1}+2 a_{2}+3 a_{3}+\ldots+n a_{n}=6 n
$$

and

$$
\frac{1}{a_{1}}+\frac{2}{a_{2}}+\frac{3}{a_{3}}+\ldots+\frac{n}{a_{n}}=2+\frac{1}{n}
$$
Solution. If we apply the inequality of the arithmetic and harmonic mean to $a_{1}$, twice $a_{2}$, three times $a_{3}, \ldots, n$ times $a_{n}$, then we find

$$
\frac{6 n}{\frac{1}{2} n(n+1)}=\frac{a_{1}+2 a_{2}+3 a_{3}+\ldots+n a_{n}}{\frac{1}{2} n(n+1)} \geq \frac{\frac{1}{2} n(n+1)}{\frac{1}{a_{1}}+\frac{2}{a_{2}}+\frac{3}{a_{3}}+\ldots+\frac{n}{a_{n}}}=\frac{\frac{1}{2} n(n+1)}{2+\frac{1}{n}} .
$$

It holds that

$$
\frac{6 n}{\frac{1}{2} n(n+1)}=\frac{12}{n+1}\frac{\frac{1}{2} n^{2}(n+1)}{2 n+2}=\frac{1}{4} n^{2} .
$$

All together, we find $\frac{12}{n}>\frac{1}{4} n^{2}$, or $48>n^{3}$, from which it follows that $n \leq 3$.

For $n=1$, we get $a_{1}=6$ and $\frac{1}{a_{1}}=3$, which contradicts each other. So $n=1$ is not possible.

For $n=2$, we get $a_{1}+2 a_{2}=12$ and $\frac{1}{a_{1}}+\frac{2}{a_{2}}=2+\frac{1}{2}$. If $a_{2} \geq 2$, then $\frac{1}{a_{1}}+\frac{2}{a_{2}} \leq 1+1$ and that is too small. So $a_{2}$ must be $1$, but then we find $a_{1}=12-2=10$ and thus $\frac{1}{a_{1}}+\frac{2}{a_{2}}=\frac{1}{10}+2$, a contradiction. So $n=2$ is not possible.

For $n=3$, there is a solution, namely $a_{1}=6, a_{2}=3$ and $a_{3}=2$ (substitution shows that this satisfies the conditions). So $n=3$ is possible and we conclude that $n=3$ is the only solution.