5. Can the 8 natural numbers $1,2,3,4,5,6,7,8$ be divided into two groups of 4 numbers each such that the sum of the numbers in the first group equals the sum of the numbers in the second group, and the sum of the squares of the numbers in the first group equals the sum of the squares of the numbers in the second group
Solution. The sum of the numbers from 1 to 8 is 36, and the sum of their squares is 204. Therefore, we need to find a quartet of numbers from $1, \ldots, 8$, the sum of which is 18, and the sum of their squares is 102. Assume that this quartet contains 8. Then the sum of the squares of the other three numbers in the quartet is 38. This implies that the quartet does not contain 7 and 6, but does contain 5, since $1^{2}+2^{2}+3^{2}+4^{2}<38$. Then the sum of the two remaining numbers is $18-(8+5)=5$, and the sum of their squares is $102-(64+25)=13$. This uniquely determines the pair of numbers 2,3. Answer: the numbers can be divided into the following groups $\{2,3,5,8\},\{1,4,6,7\}$.