Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed that


and also


Is there an easy way to find all pairs of disjoint sets of positive integers whose sum are the same and whose sum of squares are the same? How common are they?

share|cite|improve this question
I can't find any good tags for this problem. I tried pythagorean triples, pythagorean sums, anything starting with pytha, but nothing came up – dspyz Apr 22 '13 at 3:00
what's special with $3,4,15,9,13$? – Next Apr 22 '13 at 3:32
I want to know a way of generating all pairs of sets like {{3,4,15},{9,13}} that have the property that they have the same sum and also the same sum of squares – dspyz Apr 22 '13 at 4:12
Here is a link… – Next Apr 22 '13 at 8:31
up vote 2 down vote accepted

It is easy to generate two such sets of arbitrary length. Let us choose $s_1,s_2,\ldots,s_{n-1}$ and $t_1,t_2,\ldots,t_{m-1}$ fairly freely and write $$ \begin{array}{cc} \sigma_1 = \sum_{i=1}^{n-1} s_i &~& \sigma_2 = \sum_{i=1}^{n-1} s_i^2 \\ \tau_1 = \sum_{i=1}^{m-1} t_i &~& \tau_2 = \sum_{i=1}^{m-1} t_i^2 \\ \end{array} $$ and then try to see if we can choose $s_n,t_m$ to augment our lists and satisfy the desired criterion, that is $$ \begin{align} \sigma_1-\tau_1 &= t_m-s_n \\ \sigma_2-\tau_2 &= t_m^2-s_n^2 \\ &=(t_m-s_n)(t_m+s_n) \\ &=(\sigma_1-\tau_1)(t_m+s_n) \end{align} $$ The easiest case is if $|\sigma_1-\tau_1|=1$ and $\sigma_2-\tau_2$ is odd, then we can choose $s_n,t_m=\frac{1}{2}(|\sigma_2-\tau_2|\pm 1)$.

For example for $n=11,m=8$, let $\{s_i\}_{i=1}^{10} = \{1,2,3,5,8,13,21,34,55,89\}$, $\{t_i\}_{i=1}^7=\{4,9,16,25,36,49,93\}$ where we have picked $t_7=93$ to achieve $\tau_1=232=\sigma_1+1$ because we will have $\tau_2>\sigma_2$.

Then $\tau_2-\sigma_2 = 509$, so let $s_{11}=255,t_8=254$ to get

$$\small 1+2+3+5+8+13+21+34+55+89+255=4+9+16+25+36+49+93+254=486 $$ $$ 1^2+2^2+3^2+5^2+8^2+13^2+21^2+34^2+55^2+89^2+255^2 \\ =4^2+9^2+16^2+25^2+36^2+49^2+93^2+254^2 = 77840 $$

In order to get every solution you'll have to consider any possible value of $d=|\sigma_1-\tau_1|$, and sets for which at least

  • $d$ divides $|\sigma_2-\tau_2|$
  • $(\sigma_2-\tau_2)/d \equiv d\pmod{2}$, since they sum to $2t_m$
  • after adding $s_n,t_m$ the sets are still disjoint

and if you want to count without repetition then only include new solutions when $s_n$ and $t_m$ are the maximums of their respective sets.

share|cite|improve this answer

I don't know that this is a complete parametrization, but if one takes any $y,z$ and then puts $x=(1+y)(1+z)$ and also $a=y+z+yz$ and $b=1+y+z$, one has $$x+y+z=a+b,\\ x^2+y^2+z^2=a^2+b^2.$$ Of course one can permute the formulas and get others; maybe someone can show this list is complete (I'll try for that). By the way I used maple12's "isolve" to get this parametric solution, and in general isolve is not guaranteed to get all solutions.

share|cite|improve this answer

set of equations:


Solutions and can be written as follows.






And more:






$k,t,q$ - are integers and can be any mark.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.