<s>[INST] Is there any general method for solving $(a_1+a_2+..a_n)^2=a_1^3+a_2^3+...+a_n^3$ in positive integers $a_1,a_2,...a_n$? We know the identity $(1+2+...+n)^2=1^3+2^3+...+n^3$ . So I was thinking , for given $n\in \mathbb N$ ,  is there any general method for solving $(a_1+a_2+..a_n)^2=a_1^3+a_2^3+...+a_n^3$ in positive integers ? At least can we find all positive integers $a,b,c$ such that $(a+b+c)^2=a^3+b^3+c^3$ ?
 [/INST] 
If $(a_1+a_2+\cdots+a_n)^2=a_1^3+a_2^3+\cdots+a_n^3$ and $m=\max a_k$, then $m\le n^2$.

Indeed, $m^3 \le \sum_{k=1}^n a_k^3 = \left( \sum_{k=1}^n a_k \right)^2 \le (nm)^2 = n^2m^2$.
This makes your last question easy to answer:
Indeed, if $(a+b+c)^2=a^3+b^3+c^3$ then $a,b,c \le 3^2=9$.
Testing all possibilities gives exactly two solutions: $(1,2,3)$ and $(3,3,3)$.
</s>