Mathematica Stack Exchange is a question and answer site for users of Mathematica. 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 need to solve the system of equations, call it $S_1$, in the integers

$$x_1x_2x_3x_4x_5 = y_1y_2y_3y_4y_5$$

$$x_1^k+x_2^k+\dots+x_5^k=y_1^k+y_2^k+\dots+y_5^k,\;\; k= 2,4,6$$

I used a very primitive code using KSubsets[], Table[], Sort[], and Do[], and with $x_i, y_i\le 50$ found one,

$$2\cdot16\cdot25\cdot45\cdot48 =3\cdot9\cdot32\cdot40\cdot50$$

$$2^k+16^k+25^k+45^k+48^k = 3^k+9^k+32^k+40^k+50^k$$

Using this single example, I managed to find a parametrization, so $S_1$ has an infinite number of primitive solutions. However, I would like to find other small solutions to $S_1$, perhaps $x_i, y_i\le 300$, (which hopefully belongs to other families). Is there an efficient way to do it with Mathematica? The code I used takes forever if I extend the range > 50. :(

P.S. The system $S_1$ leads to an $11$th degree identity, in case one is wondering why I am interested in it.

share|improve this question
Have you looked into FindInstance[], by any chance? – J. M. May 17 '13 at 2:47
I'm embarrassed to admit I'm still using Mathematica 4. I believe that command began with Mathematica 5. – Tito Piezas III May 17 '13 at 3:02
Do you want to solve it in Integers or Reals domain? – Silvia May 17 '13 at 3:05
Oh, well let's tag it appropriately... :) (I used version 5 for a long while before upgrading to 8 myself.) – J. M. May 17 '13 at 3:05
@TitoPiezasIII Sorry, my comment wasn't clear enough. Mma can't find a solution using that :) – Dr. belisarius May 17 '13 at 4:16
up vote 6 down vote accepted

This isn't really an answer, but it's too big for a comment.

Here's some code to brute force solve the problem (since there wasn't any code provided in the question). It lists all the possible numbers; finds the ones whose product matches; then of those, finds the ones whose sum of squares match, etc..

Module[{h = 50, r, product, squared, fourth, sixth},
  r = Flatten[
    Table[{a, b, c, d, e}, {a, h}, {b, a + 1, h}, {c, b + 1,h},
        {d, c + 1, h}, {e, d + 1, h}], 4];
  product =
    Select[GatherBy[r, Times @@ # &], Length@# > 1 &];
  squared =
    Flatten[Select[GatherBy[#, Total@(#^2) &], Length@# > 1 &] & /@ product, 1];
  fourth =
    Flatten[Select[GatherBy[#, Total@(#^4) &], Length@# > 1 &] & /@ squared, 1];
  sixth =
    Flatten[Select[GatherBy[#, Total@(#^6) &], Length@# > 1 &] & /@ fourth, 1];

It's quite fast, but runs into memory issues fairly quickly after 50. I've managed to run it up to $1 \leq x_i \leq 60$ and found no more solutions than in the question.

I've got things to be and places to do, but hopefully somebody might find this useful as a starting point. On the other hand, if you want to check up to 300, there will be 20 billion combinations to sift through using this method.


Using a C++ program to check up to 150, I've found the following solutions:

$$\begin{align} 2\cdot 16\cdot 25\cdot 45\cdot 48 &= 3\cdot 9\cdot 32\cdot 40\cdot 50\\ 2\cdot 43\cdot 52\cdot 99\cdot 114 &= 3\cdot 22\cdot 76\cdot 86\cdot 117\\ 4\cdot 32\cdot 50\cdot 90\cdot 96 &= 6\cdot 18\cdot 64\cdot 80\cdot 100\\ 8\cdot 33\cdot 38\cdot 68\cdot 87 &= 12\cdot 17\cdot 57\cdot 58\cdot 88\\ 6\cdot 37\cdot 41\cdot 87\cdot 110 &= 11\cdot 15\cdot 58\cdot 82\cdot 111\\ 8\cdot 50\cdot 51\cdot 100\cdot 123 &= 12\cdot 24\cdot 82\cdot 85\cdot 125\\ 7\cdot 56\cdot 57\cdot 102\cdot 116 &= 8\cdot 38\cdot 84\cdot 87\cdot 119\\ 11\cdot 42\cdot 58\cdot 100\cdot 105 &= 14\cdot 28\cdot 75\cdot 87\cdot 110\\ 14\cdot 44\cdot 56\cdot 93\cdot 123 &= 21\cdot 24\cdot 77\cdot 82\cdot 124\\ 4\cdot 50\cdot 57\cdot 110\cdot 129 &= 6\cdot 25\cdot 86\cdot 95\cdot 132\\ 15\cdot 43\cdot 75\cdot 116\cdot 124 &= 20\cdot 29\cdot 93\cdot 100\cdot 129\\ 6\cdot 48\cdot 75\cdot 135\cdot 144 &= 9\cdot 27\cdot 96\cdot 120\cdot 150 \end{align}$$


$$\begin{align} 2\cdot 52\cdot 72\cdot 133\cdot 147 &= 3\cdot 28\cdot 98\cdot 117\cdot 152\\ 19\cdot 48\cdot 86\cdot 143\cdot 144 &= 26\cdot 32\cdot 99\cdot 129\cdot 152\\ 4\cdot 41\cdot 86\cdot 144\cdot 159 &= 9\cdot 16\cdot 106\cdot 129\cdot 164\\ 16\cdot 66\cdot 76\cdot 136\cdot 174 &= 24\cdot 34\cdot 114\cdot 116\cdot 176\\ 12\cdot 59\cdot 82\cdot 143\cdot 174 &= 22\cdot 26\cdot 116\cdot 123\cdot 177\\ 11\cdot 75\cdot 100\cdot 148\cdot 183 &= 12\cdot 61\cdot 125\cdot 132\cdot 185\\ 16\cdot 53\cdot 102\cdot 176\cdot 177 &= 24\cdot 32\cdot 118\cdot 159\cdot 187\\ 24\cdot 74\cdot 105\cdot 172\cdot 175 &= 28\cdot 56\cdot 129\cdot 150\cdot 185\\ 3\cdot 32\cdot 112\cdot 182\cdot 183 &= 7\cdot 13\cdot 122\cdot 168\cdot 192\\ 8\cdot 34\cdot 132\cdot 171\cdot 185 &= 11\cdot 24\cdot 148\cdot 153\cdot 190\\ 15\cdot 71\cdot 75\cdot 164\cdot 212 &= 20\cdot 41\cdot 100\cdot 159\cdot 213\\ 8\cdot 64\cdot 100\cdot 180\cdot 192 &= 12\cdot 36\cdot 128\cdot 160\cdot 200\\ 12\cdot 74\cdot 82\cdot 174\cdot 220 &= 22\cdot 30\cdot 116\cdot 164\cdot 222\\ 16\cdot 96\cdot 106\cdot 189\cdot 209 &= 19\cdot 64\cdot 154\cdot 159\cdot 216\\ 26\cdot 74\cdot 123\cdot 177\cdot 220 &= 30\cdot 59\cdot 143\cdot 164\cdot 222\\ 22\cdot 84\cdot 116\cdot 200\cdot 210 &= 28\cdot 56\cdot 150\cdot 174\cdot 220\\ 16\cdot 66\cdot 119\cdot 208\cdot 213 &= 24\cdot 39\cdot 142\cdot 187\cdot 224\\ 4\cdot 86\cdot 104\cdot 198\cdot 228 &= 6\cdot 44\cdot 152\cdot 172\cdot 234\\ 9\cdot 65\cdot 118\cdot 200\cdot 228 &= 20\cdot 25\cdot 152\cdot 177\cdot 234\\ 24\cdot 84\cdot 122\cdot 209\cdot 217 &= 31\cdot 56\cdot 154\cdot 183\cdot 228\\ 28\cdot 88\cdot 112\cdot 186\cdot 246 &= 42\cdot 48\cdot 154\cdot 164\cdot 248\\ 28\cdot 58\cdot 133\cdot 213\cdot 222 &= 37\cdot 42\cdot 142\cdot 203\cdot 228\\ 8\cdot 29\cdot 142\cdot 219\cdot 228 &= 12\cdot 19\cdot 146\cdot 213\cdot 232\\ 16\cdot 100\cdot 102\cdot 200\cdot 246 &= 24\cdot 48\cdot 164\cdot 170\cdot 250\\ 14\cdot 112\cdot 114\cdot 204\cdot 232 &= 16\cdot 76\cdot 168\cdot 174\cdot 238\\ 30\cdot 77\cdot 126\cdot 205\cdot 244 &= 35\cdot 61\cdot 140\cdot 198\cdot 246\\ 10\cdot 80\cdot 125\cdot 225\cdot 240 &= 15\cdot 45\cdot 160\cdot 200\cdot 250 \end{align}$$

share|improve this answer
OP is on version 4, so he won't have GatherBy[] handy. – J. M. May 17 '13 at 4:46
@Wxffles: The code I came up with used Table[] and KSubsets[] to generate all possible sums $a^k+b^k+c^k+d^k+e^k$ for $k=6$, then used Sort[], then Do[] to filter out those valid for $k=2,4$ as well as being equal products. It was slow, cumbersome, and also ran into memory issues. But thanks so much for the effort though. – Tito Piezas III May 17 '13 at 14:54
@Wxffles: Wonderful! In general, $S_1$ leads to an multi-grade $11$th deg equality with 16 terms on each side. But with appropriate linear relations among the terms of $S_1$, this can be reduced. Your fourth solution reduces it to just 11 terms on each side, namely {$117, -84, -79, -49, -3, -8, -38, 22, 71, 76, -109$} = {$116, -99, -59, -58, -28, 42, 1, -29, 47, 87, -104$} the kth powers have equal sums for $k = 1,2,3,4,5,6,7,9,11$. Thanks so much! Now I'll inspect this solution if it belongs to a family. – Tito Piezas III May 17 '13 at 21:58
@Wxffles: Thanks! I found that for your first edit, excepting two solns, the rest fell into 2 families. The 1st can be solved by quadratic forms, the 2nd can be reduced to an elliptic curve. The latter is {$4a−4b,3b−2c,3b+2c,6a,4a+4b$} = {$b−2c,b+2c,4a,−a+d,a+d$} where $−4a^2+5b^2=4c^2,\;25a^2+24b^2=d^2$. The intersection of these two is an elliptic curve and one soln is {$a,b,c,d$}={$29,26,2,193$} which gives the 5th in your list. If you like this programming problem, can you kindly email me at as I have a similar one that is simply begging for more solutions. – Tito Piezas III May 30 '13 at 18:27

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.