Minimize $a^5+b^5+c^5+d^5+e^5 = p^4+q^4+r^4+s^4 = x^3+y^3+z^3 = m^2 + n^2$ with distinct positive integers

150 Views Asked by At

Find the minimum value of the following: $$a^5+b^5+c^5+d^5+e^5 = p^4+q^4+r^4+s^4 = x^3+y^3+z^3 = m^2 + n^2$$ where all numbers are different/distinct positive integers.

I know the answer (see below), but want to confirm the same.

Is there any way to prove following conjecture?

Conjecture. There is always unique way to write down $\sum_{i=1}^{n} a_{i}^n$ for any arbitrary value of $n$ such that it gives same value for all values of $n$.


Answer is given below, spoiler alert:

$$1^5+2^5+4^5+7^5+9^5 = 3^4+6^4+10^4+16^4 = 17^3+20^3+40^3 = 88^2 + 263^2 = 76913$$

5

There are 5 best solutions below

5
On BEST ANSWER

the smallest is

76913 squares of: 263  88
76913 cubes of: 40  17  20
76913 fourth powers of: 16  3  6  10
76913 fifth powers of: 9  1  2  4  7
76913

the second smallest is

1560402 squares of: 1239  159
1560402 cubes of: 101  45  76
1560402 fourth powers of: 35  5  12  14
1560402 fifth powers of: 17  1  6  8  10
1560402

Here is another one. It may or may not be the third smallest.

2091473 squares of: 1367  472
2091473 cubes of: 122  10  65
2091473 fourth powers of: 32  14  21  30
2091473 fifth powers of: 17  4  8  10  14
    2091473
0
On
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <strstream>
#include <list>
#include <set>
#include <math.h>
#include <iomanip>
#include <string>
#include <algorithm>
#include <iterator>
#include <gmp.h>
#include <gmpxx.h>
#include "form.h"

using namespace std;


int is_2_different_positive_2th_powers(mpz_class n)
{
  int fail = 1;
  for(mpz_class z = 1; fail && z * z < n; ++z){
    if(  mp_SquareQ(n - z * z )  )
    {
      mpz_class y =  mp_Sqrt(n - z * z );
      if ( y >= 1 && y != z   )
      { 
        fail = 0;
       // cout << n << " squares of: " << y << "  " << z << endl; 
      }
    }
  }
  return !fail;
}

int is_3_different_positive_3th_powers(mpz_class n)
{
  int fail = 1;
  for(mpz_class z = 2; fail && z * z * z < n; ++z){
  for(mpz_class y = 1; fail && y < z && y * y * y + z * z * z < n; ++y){
    mpz_class xxx = n - (y * y * y + z * z * z) ;
    if (mp_CubeQ( xxx) )
    {
       mpz_class x = mp_Cube_Root(xxx);
       if ( x > 0 && x != y && x != z)
       { 
        fail = 0;
       // cout << n << " cubes of: " << x << "  " << y << "  " << z << endl; 
      } 
    }

  }}
  return !fail;
}

int is_4_different_positive_4th_powers(mpz_class n)
{
  int fail = 1;
  for(mpz_class z = 3; fail && z * z * z * z < n; ++z){
  for(mpz_class y = 2; fail && y < z && y * y * y * y + z * z * z * z < n; ++y){
  for(mpz_class x = 1; fail && x < y && x * x * x * x + y * y * y * y + z * z * z * z < n; ++x){
     mpz_class wwww = n - (  x * x * x * x + y * y * y * y + z * z * z * z );
     if(  mp_Fourth_Power_Q(wwww ))
     {
       mpz_class w = mp_Fourth_Root(wwww);
       if( w > 0 && w != x && w != y && w != z)
      { 
        fail = 0;
       // cout << n << " fourth powers of: " <<  w << "  " << x << "  " << y << "  " << z << endl; 
      } 


     }
  }}}
  return !fail;
}



int is_5_different_positive_5th_powers(mpz_class n)
{
  int fail = 1;
  for(mpz_class z = 4; fail && to_power_5(z) < n; ++z){
  for(mpz_class y = 3; fail && y < z && to_power_5(y) + to_power_5(z) < n; ++y){
  for(mpz_class x = 2; fail && x < y && to_power_5(x) + to_power_5(y) + to_power_5(z) < n; ++x){
  for(mpz_class w = 1; fail && w < x &&  to_power_5(w) + to_power_5(x) + to_power_5(y) + to_power_5(z) < n; ++w){
     mpz_class vvvvv = n - (  to_power_5(w) + to_power_5(x) + to_power_5(y) + to_power_5(z) );
     if(  mp_Fifth_Power_Q(vvvvv))
     {
       mpz_class v =  mp_Fifth_Root(vvvvv);
       if( v > 0 && v != w && v != x && v != y && v != z) 
       { 
        fail = 0;
       // cout << n << " fifth powers of: " <<  v << "  " << w << "  " << x << "  " << y << "  " << z << endl; 
      } 


     }
  }}}}
  return !fail;
}


int is_6_different_positive_6th_powers(mpz_class n)
{
  int fail = 1;
  for(mpz_class z = 5; fail && to_power_6(z) < n; ++z){
  for(mpz_class y = 4; fail && y < z && to_power_6(y) + to_power_6(z) < n; ++y){
  for(mpz_class x = 3; fail && x < y && to_power_6(x) + to_power_6(y) + to_power_6(z) < n; ++x){
  for(mpz_class w = 2; fail && w < x &&  to_power_6(w) + to_power_6(x) + to_power_6(y) + to_power_6(z) < n; ++w){
  for(mpz_class v = 1; fail && v < w &&  to_power_6(v) + to_power_6(w) + to_power_6(x) + to_power_6(y) + to_power_6(z) < n; ++w){
     mpz_class uuuuuu = n - (  to_power_6(v) + to_power_6(w) + to_power_6(x) + to_power_6(y) + to_power_6(z)  );
     if(  mp_Sixth_Power_Q( uuuuuu))
     {
       mpz_class u =  mp_Sixth_Root(uuuuuu);
       if( u > 0 && u != v && u != w && u != x && u != y && u != z) 
       { 
        fail = 0;
     //   cout << n << " sixth powers of: " <<   u << "  " << v << "  " << w << "  " << x << "  " << y << "  " << z << endl; 
      } 


     }
  }}}}}
  return !fail;
}




int main()
{
   for(mpz_class p = 1; p <= 1000000000; p += 4 ){
   if( p % 10000 == 1 ) cerr << p << endl;
     if (  mp_PrimeQ(p) &&   is_2_different_positive_2th_powers(p) && is_3_different_positive_3th_powers(p) && is_4_different_positive_4th_powers(p)  && is_5_different_positive_5th_powers(p)  && is_6_different_positive_6th_powers(p)) cout << "    " << p << endl;
   }


    return 0 ;
}
0
On
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <sstream>
#include <list>
#include <set>
#include <math.h>
#include <iomanip>
#include <string>
#include <algorithm>
#include <iterator>
#include <gmp.h>
#include <gmpxx.h>
using namespace std;


const int LARGEINT = 2147483647  ;
const int BILLION  = 1000000000  ;
const double my_pi = 4 * atan(1.0);

//  form.h      



int mp_PrimeQ( mpz_class  i)
{
  if ( i <= 0 ) return 0;
  else if ( i == 1 ) return 1;
  else return  mpz_probab_prime_p( i.get_mpz_t() , 10 );
} // mp_PrimeQ


int  mp_SquareQ( mpz_class  w)
{
  if (w < 0) return 0;
  else if (w < 2) return 1;
  else
  {
    mpz_class squirt;
    mpz_sqrt( squirt.get_mpz_t(), w.get_mpz_t()  );
    return (w ==  squirt * squirt);
  }  // else w >= 2;
}

mpz_class mp_Sqrt( mpz_class  w)
{
  if (w <= 0) return 0;
  else if (w < 2) return 1;
  else
  {
    mpz_class squirt;
    mpz_sqrt( squirt.get_mpz_t(), w.get_mpz_t()  );
    return  squirt ;
  }  // else w >= 2;
}



int  mp_CubeQ( mpz_class  w)
{
  mpz_class temp = w;
  if (temp < 0) temp *= -1;
  if (temp < 2) return 1;
  else
  {
    mpz_class root;
    mpz_root( root.get_mpz_t(), temp.get_mpz_t(), 3  );
  //  cout << " root " << root <<  "  temp " << temp << endl;
    return (temp ==  root * root * root);
  }  // else w >= 2;
}

mpz_class mp_Cube_Root( mpz_class  w)
{
   mpz_class temp = w;
  if (temp < 0) temp *= -1;
  if( temp == 0) return 0;
  else  if (temp < 2) return 1;
  else
  {
    mpz_class root;
    mpz_root( root.get_mpz_t(), temp.get_mpz_t(), 3  );
  //  cout << " root " << root <<  "  temp " << temp << endl;
    return  root;
  }  // else w >= 2; 
}

mpz_class mp_Fourth_Root( mpz_class  w)
{
   mpz_class temp = w;
  if (temp < 0) temp *= -1;
  if( temp == 0) return 0;
  else  if (temp <= 15) return 1;
  else
  {
    mpz_class root;
    mpz_root( root.get_mpz_t(), temp.get_mpz_t(), 4  );
  //  cout << " root " << root <<  "  temp " << temp << endl;
    return  root;
  }  // else w >= 2; 
}


int  mp_Fourth_Power_Q( mpz_class  w)
{
  mpz_class temp = w;
  mpz_class root = mp_Fourth_Root( w);
  return root * root * root * root == w;
}

mpz_class mp_Fifth_Root( mpz_class  w)
{
   mpz_class temp = w;
  if (temp < 0) temp *= -1;
  if( temp == 0) return 0;
  else  if (temp <= 31) return 1;
  else
  {
    mpz_class root;
    mpz_root( root.get_mpz_t(), temp.get_mpz_t(), 5  );
  //  cout << " root " << root <<  "  temp " << temp << endl;
    return  root;
  }  // else w >= 2; 
}


int  mp_Fifth_Power_Q( mpz_class  w)
{
  mpz_class temp = w;
  mpz_class root = mp_Fifth_Root( w);
  return root * root * root * root * root == w;
}


mpz_class to_power_5( mpz_class w)
{
  return w * w * w * w * w;
}


//    6     
mpz_class mp_Sixth_Root( mpz_class  w)
{
   mpz_class temp = w;
  if (temp < 0) temp *= -1;
  if( temp == 0) return 0;
  else  if (temp <= 63) return 1;
  else
  {
    mpz_class root;
    mpz_root( root.get_mpz_t(), temp.get_mpz_t(), 6  );
  //  cout << " root " << root <<  "  temp " << temp << endl;
    return  root;
  }  // else w >= 2; 
}


int  mp_Sixth_Power_Q( mpz_class  w)
{
  mpz_class temp = w;
  mpz_class root = mp_Sixth_Root( w);
  return root * root * root * root * root * root == w;
}


mpz_class to_power_6( mpz_class w)
{
  return w * w * w * w * w * w;
}
5
On

Alright, it turns out that the right way to do this is one multiple loop to produce sums of the highest exponent under consideration, then test those as sums of distinct powers with the lower exponents. The point is that, as the exponent increases, the sums get scarcer and scarcer, so it is a gigantic waste to test from the bottom up. Here are all those that work up to exponent $5$ up to 10,000,000. Note that they are not in increasing order, they are instead in order of the largest $x_5$ in $n = x_1^5 + ... + x_5^5$

Sat May 21 10:04:16 PDT 2016
76913 =  76913    count:  1
1560402 =  2 3^2 86689    count:  2
1792449 =  3^4 22129    count:  3
2091473 =  2091473    count:  4
3449969 =  3449969    count:  5
3980017 =  3980017    count:  6
5542594 =  2 2771297    count:  7
8603153 =  13 41 16141    count:  8
7175969 =  43^2 3881    count:  9
8464113 =  3^2 7^2 17 1129    count:  10 
7902369 =  3^2 878041    count:  11
7502993 =  181 41453    count:  12
7949041 =  641 12401    count:  13
9453634 =  2 4726817    count:  14
9467074 =  2 4733537    count:  15
8907634 =  2 4453817    count:  16
9044993 =  9044993    count:  17
9801793 =  9801793    count:  18
Sat May 21 10:55:06 PDT 2016

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Sordid:

jagy@phobeusjunior:~$ sort -n five.txt
76913 =  76913    count:  1
1560402 =  2 3^2 86689    count:  2
1792449 =  3^4 22129    count:  3
2091473 =  2091473    count:  4
3449969 =  3449969    count:  5
3980017 =  3980017    count:  6
5542594 =  2 2771297    count:  7
7175969 =  43^2 3881    count:  9
7502993 =  181 41453    count:  12
7902369 =  3^2 878041    count:  11
7949041 =  641 12401    count:  13
8464113 =  3^2 7^2 17 1129    count:  10 
8603153 =  13 41 16141    count:  8
8907634 =  2 4453817    count:  16
9044993 =  9044993    count:  17
9453634 =  2 4726817    count:  14
9467074 =  2 4733537    count:  15
9801793 =  9801793    count:  18
jagy@phobeusjunior:~$
0
On

Thanks Will Jagy for sharing the code. I had used following VBA code in excel

Sub Power5()
For u = 1 To 10
    For v = u + 1 To 10
        For w = v + 1 To 10
            For x = w + 1 To 10
                For y = x + 1 To 10
                    mysum = u ^ 5 + v ^ 5 + w ^ 5 + x ^ 5 + y ^ 5
                    For p = 1 To 100
                        For q = p + 1 To 100
                            For r = q + 1 To 100
                                For s = r + 1 To 100
                                    If p ^ 4 + q ^ 4 + r ^ 4 + s ^ 4 = mysum Then
                                        For i = 1 To 100
                                            For j = i + 1 To 100
                                                For k = j + 1 To 100
                                                    If i ^ 3 + j ^ 3 + k ^ 3 = mysum Then
                                                        For a = 1 To 1000
                                                            For b = a + 1 To 1000
                                                                If a ^ 2 + b ^ 2 = mysum Then
                                                                    n = n + 1: Cells(n, 1) = u & "| " & v & "| " & w & "| " & x & "| " & y & "<|> " & p & "| " & q & "| " & r & "| " & s & "<|> " & i & "| " & j & "| " & k & "<|> " & a & "| " & b
                                                                    GoTo Mynext
                                                                End If
                                                            Next
                                                        Next
                                                    End If
                                                Next
                                            Next
                                        Next
                                    End If
                                Next
                            Next
                        Next
                    Next
                Next
            Next
        Next
Mynext:
    Next
Next

End Sub