9
$\begingroup$

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.

  • 1
    Nice question. And I am wondering if such groups are unique2017-02-18
  • 1
    @Display name I agree that I missed that the groups have to be of equal sizes. But concerning the argument that the OP demands an algorithm : Brute force is always a possibility (if a solution actually exists), so I disagree concerning this. The question does not demand an efficient algorithm.2017-02-18
  • 1
    If these three groups exist, then the sum of their elements should be $60147$2017-02-18
  • 0
    related problem : en.m.wikipedia.org/wiki/Subset_sum_problem2017-02-18

2 Answers 2

5

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.

2

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]
?
  • 0
    Should be comment as OP specifically asked for an algorithm2017-02-18
  • 0
    I think, there is a method to produce the vectors systematically, but I have no idea how to do this.2017-02-18
  • 0
    It took me great effort and several tries to get a solution! I guess, this is not the only one.2017-02-18
  • 0
    I think this question asks for square numbers only, not for a number like 14.2017-02-18
  • 1
    @DougSpoonwood, and in fact the sums of the squares of the numbers in each of the three lists are equal.2017-02-18
  • 0
    @AndreasCaranti Of course, the entries have to be squared and then added.2017-02-18
  • 0
    What is the algorithm of this solution???2017-02-18
  • 0
    As I already said, I have no idea for an (efficient) algorithm, I just wanted to make sure that a solution actually exists.2017-02-18