找一個最小的自然數x
x=a*a*a+b*b*b=c*c*c+d*d*d
其中a
要求
int max =
int[] Arr = new int[max];
for (int i =
{
Arr[i] = (i + 1) * (i + 1) * (i + 1);
}
int a = 0;
int b = 1;
int c = 2;
int d = 3;
bool flag = true;
while ( flag)
{
b = a + 1;
while (b < max – 2 && flag)
{
c = b + 1;
while (c < max – 1 && flag)
{
d = c + 1;
while (Arr[d] <= Arr[c] + Arr – Arr[a] && flag)
{
if (Arr[a] + Arr[d] == Arr[c] + Arr)
{
Console.WriteLine(a + 1);
Console.WriteLine(b + 1);
Console.WriteLine(c + 1);
Console.WriteLine(d + 1);
Console.WriteLine(Arr[a] + Arr[d]);
Console.WriteLine(Arr + Arr[c]);
flag = false;
}
d++;
}
c++;
}
b++;
}
a++;
}
From:http://tw.wingwit.com/Article/program/sjjg/201405/30930.html