<s>[INST] Divide $1^2,2^2..,81^2$ numbers into 3 groups. Given $1^2,2^2,3^2,.....,81^2$ numbers. How can I divide them into $3$ groups with $27$ numbers in each so that they have the same sum.
Is there any algorithm to solve this task?
Thanks in Advance.
 [/INST] We take a sequence of 9 consecutive squares, $n^2, (n+1)^2,...,(n+8)^2$. Then,
$$(n+0)^2 + (n+4)^2 + (n+8)^2 = 3n^2 + 24n + 80$$
$$(n+1)^2 + (n+5)^2 + (n+6)^2 = 3n^2 + 24n + 62$$
$$(n+2)^2 + (n+3)^2 + (n+7)^2 = 3n^2 + 24n + 62$$ 
So, we can divide 27 squares into 3 groups of equal sum, by rotating the dominant group out of these 9. We can then divide total 81 into 3 groups of 27 each, which in turn can be divided into 3 groups of 9 with equal sum each. All that is left is to take one 9-group each from these 3 sets.
</s>