Determine two positive integers x and y, with x>y, such that:
- y divides x, and:
- x-y is the harmonic mean of x/y and x*y.
clearvars,clc
for x=1:1000
d=divisors(x);
for i=1:length(d)
y=d(i);
if y<x
if (x-y)*(y^2+1)==2*x*y
disp([x y])
end
end
end
end
finds
x=10
y=2
x-y=8
harmonic mean:
2 2*x*y 40
------------- = ------- = ---- = 8
(y/x)+1/(x*y) y^2 + 1 5
|
Posted by Charlie
on 2022-09-15 15:06:26 |