There is a conjecture in mathematics that held for over two hundred years before it was disproved by the finding of a counterexample in 1966 by Lander and Parkin.



Euler's (disproved) sum of powers   conjecture

  At least  k  positive  kth  powers are required to sum to a  kth  power,  
  except for the trivial case of one  kth power:  yk = yk 



In 1966,   Leon J. Lander   and   Thomas R. Parkin   used a brute-force search on a   CDC 6600   computer restricting numbers to those less than 250.



Task

Write a program to search for an integer solution for:


  x05 + x15 + x25 + x35 == y5 

Where all     xi's   and    y    are distinct integers between   0   and   250   (exclusive).

Show an answer here.



Related tasks

   Pythagorean quadruples. 
   Pythagorean triples.


 
const std = @import("std");
const stdout = std.io.getStdOut().outStream();
 
pub fn main() !void {
    var pow5: [250]i64 = undefined;
    for (pow5) |*e, i| {
        const n = @intCast(i64, i);
        e.* = n * n * n * n * n;
    }
    var x0: u16 = 4;
    while (x0 < pow5.len) : (x0 += 1) {
        var x1: u16 = 3;
        while (x1 < x0) : (x1 += 1) {
            var x2: u16 = 2;
            while (x2 < x1) : (x2 += 1) {
                var x3: u16 = 1;
                while (x3 < x2) : (x3 += 1) {
                    const sum = pow5[x0] + pow5[x1] + pow5[x2] + pow5[x3];
                    var y: u16 = x0 + 1;
                    while (y < pow5.len) : (y += 1) if (sum == pow5[y]) {
                        try stdout.print("{}⁵ + {}⁵ + {}⁵ + {}⁵ = {}⁵\n", .{ x0, x1, x2, x3, y });
                        return;
                    };
                }
            }
        }
    }
 
    try stdout.print("Sorry, no solution found.\n", .{});
}
 