Answer the question
In order to leave comments, you need to log in
Find the smallest natural number n that can be represented in two different ways as the sum of cubes of two natural numbers x3 + y3 (x >= y)?
Find the smallest natural number n that can be represented in two different
ways as the sum of cubes of two natural numbers x3 + y3 (x >= y)
pascal code:
const
eps = 0.00001;
var
x, y, n, x1, y1: longint;
tmp: real;
begin
x := 0;
while true do
begin
inc(x);
y := 0;
while (y < x) do
begin
inc(y);
n := x * x * x + y * y * y;
x1 := x;
y1 := y;
while x1 > 1 do
begin
dec(x1);
tmp := exp(ln(n - x1 * x1 * x1) / 3);
if trunc(tmp) > x1 then
break;
if (Frac(tmp) < eps) or (1 - Frac(tmp) < eps) then
begin
y1 := round(tmp);
writeln(x, ' ', y, ' ', x1, ' ', y1);
readln;
end;
end;
end;
end;
end.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question