FR | EN
Quentin L. Meunier
Associate Professor in Computer Science at Sorbonne Université

Problem 1016

Alice writes the integers from 1 to 8.

She separates them into two groups of four and realizes that the sum of the squares of the numbers in the first group (the one that contains 1) is equal to the sum of the squares of the numbers in the second group.

Alice then repeats the experiment with the numbers from 21 to 28.

Bob tries the same experiment with numbers from 1 to 12.



For this problem, a simple enumeration suffices. The only differences between the questions are the first number, the last number, and the fact that the groups are of equal size or not. The program written uses defines for these values.
  • Question 1: N = 8, OFFSET = 1, EGAL = 1 (EGAL means EQUAL)
  • Question 2.A: N = 8, OFFSET = 21, EGAL = 1
  • Question 2.B: N = 12, OFFSET = 1, EGAL = 1
  • Question 2.C: N = 12, OFFSET = 1, EGAL = 0
The code is available here.




  • 1A, 1B, 1C. 4, 6 and 7.
  • 2A. There is only one way to separate the integers from 21 to 28 into two groups of equal size, with the same sum of squares.
  • 2B. There is only one way to separate the integers from 1 to 12 into two groups of six, with the same sum of squares.
  • 2C. There are 4 ways to separate integers from 1 to 12 into two groups of unequal size, with the same sum of squares.