Needs["Combinatorica`"]
five[n_] :=
Module[{v =
SparseArray[LowerTriangularize[Outer[Plus, #, #] &[Range[n]^4]]][
"NonzeroValues"], t, k, x55, a, b, s, x1, x2, x3, x4},
k = Ordering@v;
t = v[[k]];
Monitor[Do[x55 = x5^4; a = 1;
Do[s = x55 - t[[b]]; While[t[[a]] < s, ++a];
If[t[[a]] == s, x2 = Round[Sqrt[2 k[[a]]]];
x1 = k[[a]] - x2 (x2 - 1)/2; x4 = Round[Sqrt[2 k[[b]]]];
x3 = k[[b]] - x4 (x4 - 1)/2;
If[x2 <= x3 || x4 <= x1, Print@{x1, x2, x3, x4, x5}]], {b,
Ceiling@BinarySearch[t, x55/2], 1, -1}], {x5, 2, n}],
Row[{ProgressIndicator[x5, {2, n}], x5}, " "]]
]
(*in:five[353]
out:res = {272, 315, 30, 120, 353}
res[[1]]^4 + res[[2]]^4 + res[[3]]^4 + res[[4]]^4 - res[[5]]^4==0*)
The C language environment is already configured. I have tried the following code:
Needs["Combinatorica`"]
Needs["CCompilerDriver`GenericCCompiler`"]
$CCompiler = {"Compiler" ->
CCompilerDriver`GenericCCompiler`GenericCCompiler,
"CompilerInstallation" -> "D:\\Program Files (x86)\\mingw64\\bin",
"CompilerName" -> "gcc.exe"};
five = Compile[{{n, _Integer}},
Module[{v =
SparseArray[LowerTriangularize[Outer[Plus, #, #] &[Range[n]^4]]][
"NonzeroValues"], t, k, x55, a, b, s, x1, x2, x3, x4},
k = Ordering@v;
t = v[[k]];
Monitor[Do[x55 = x5^4; a = 1;
Do[s = x55 - t[[b]]; While[t[[a]] < s, ++a];
If[t[[a]] == s, x2 = Round[Sqrt[2 k[[a]]]];
x1 = k[[a]] - x2 (x2 - 1)/2; x4 = Round[Sqrt[2 k[[b]]]];
x3 = k[[b]] - x4 (x4 - 1)/2;
If[x2 <= x3 || x4 <= x1, Print@{x1, x2, x3, x4, x5}]], {b,
Ceiling@BinarySearch[t, x55/2], 1, -1}], {x5, 2, n}],
Row[{ProgressIndicator[x5, {2, n}], x5}, " "]]
],
RuntimeAttributes -> {Listable}, Parallelization -> True,
CompilationTarget -> "C"]
It seems to have failed, and there has been no significant improvement in speed.