# Equal sums and equal sums of squares

[This is an attempt to rescue the deleted question https://math.stackexchange.com/questions/4230138/sum-of-a-list-of-squares]

Question.

Is there a set of $$4042$$ distinct positive integers that can be partitioned into two sets of $$2021$$ elements each with equal sums and equal sums of squares, that is, with
$$a_1+a_2+\cdots+a_{2021}=b_1+b_2+\cdots+b_{2021}$$ and
$$a_1^2+a_2^2+\cdots+a_{2021}^2=b_1^2+b_2^2+\cdots+b_{2021}^2?$$

I can do it with three numbers on a side: $$1^k+5^k+6^k=2^k+3^k+7^k$$ for $$k=1,2$$,
and four numbers on a side: $$1^k+4^k+6^k+7^k=2^k+3^k+5^k+8^k$$ for $$k=1,2$$,
but $$2021$$ numbers on a side is a bit much for trial and error and/or hand calculation.
Is there an efficient, systematic way to produce these things?

• I have accepted my own answer to this question, but I welcome other answers. Apr 2, 2022 at 7:53

If $$c_1+c_2+\cdots+c_n=d_1+d_2+\cdots+d_n$$, then for all $$t$$ we get $$c_1+\cdots+c_n+(d_1+t)+\cdots+(d_n+t)=(c_1+t)+\cdots+(c_n+t)+d_1+\cdots+d_n$$ and $$c_1^2+\cdots+c_n^2+(d_1+t)^2+\cdots+(d_n+t)^2=(c_1+t)^2+\cdots+(c_n+t)^2+d_1^2+\cdots+d_n^2$$
The number of terms on each side is $$2n$$, which is even, but we want it to be $$2021$$, which is odd. We can arrange for this to happen, with $$n=2022$$, by having (for example) $$c_2=c_1+t$$ but no other equal terms on the two sides of the equations, so there will be exactly one cancellation. If we take $$c_1=1$$, $$c_2=2$$, $$t=1$$, all the other $$c_i$$ to be $$2\bmod4$$ (so we don't have any other instances of $$c_i=c_j+1$$), all the $$d_i$$ to be $$0\bmod4$$, except fiddle with $$c_n$$ and $$d_n$$ to make $$\sum c_i=\sum d_i$$, then we win.