' http://rosettacode.org/wiki/Euler%27s_sum_of_powers_conjecture#FreeBASIC
' version 14-09-2015
' some constants calculated when the program is compiled
Const pow5_max
= max
* max
* max
* max
* max
' limit x1, x2, x3
Const limit_x1
= (pow5_max
/ 4) ^ 0.2 Const limit_x2
= (pow5_max
/ 3) ^ 0.2 Const limit_x3
= (pow5_max
/ 2) ^ 0.2
' ------=< MAIN >=------
pow5(x1) = x1 * x1 * x1 * x1 * x1
For x2
= x1
+ 1 To limit_x2
m1 = x1 + x2
ans1 = pow5(x1) + pow5(x2)
For x3
= x2
+ 1 To limit_x3
ans2 = ans1 + pow5(x3)
For x4
= x3
+ 1 To max
- 1 ans3 = ans2 + pow5(x4)
Print x1;
"^5 + "; x2;
"^5 + "; x3;
"^5 + "; _
x4; "^5 = "; x5; "^5"
skip: