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.
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.
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.
A solution is :
? print(x)
[1, 4, 9, 14, 15, 16, 19, 22, 26, 27, 31, 36, 38, 41, 44, 48, 49, 51, 55, 63, 67
, 68, 69, 71, 72, 74, 77]
? print(y)
[7, 8, 10, 13, 17, 20, 28, 29, 32, 33, 34, 35, 39, 40, 43, 47, 52, 53, 54, 57, 5
9, 60, 61, 64, 79, 80, 81]
? print(z)
[2, 3, 5, 6, 11, 12, 18, 21, 23, 24, 25, 30, 37, 42, 45, 46, 50, 56, 58, 62, 65,
66, 70, 73, 75, 76, 78]
?