Each of P, Q, R, and S is a positive integer with P<Q<R<S.
Find the quadruplets (P, Q, R, S) that satisfy this equation:
1/P + 1/Q + 1/R + 1/S = 1
Prove that these are the only possible quadruplets that satisfy the given conditions.
Note: Computer program solutions are welcome, but a semi-analytical solution is preferred.
clc
for p=2:5000
if 1-4/p>.000001
lastp=p;
break
end
for q=p+1 :5001
sum1=1/p+1/q;
if 1-sum1-2/q>.0001
lastq=q;
break
end
if sum1<1
for r=q+1:5002
sum2=sum1+1/r;
if 1-sum2-1/r>.00001
lastr=r;
break
end
s=1/(1-sum2);
if s>r
if abs(s-round(s))<1e-12
disp([p q r s])
end
end
end
end
end
end
P Q R S
2 3 6 9.00719925474099e+15
2 3 7 41.9999999999998
2 3 8 24
2 3 9 18
2 3 10 15
2 4 5 20
2 4 6 12
The first row is spurious; its S value would be "infinity" if it were legitimate, as the sum of the first three reciprocals completes the total of 1.
The second row has a rounding error for S.
The complete set is
2 3 7 42
2 3 8 24
2 3 9 18
2 3 10 15
2 4 5 20
2 4 6 12
The completeness is based on the points at which the break statements broke out of the loops, which was when even if the remainder of the reciprocals (such as 1/R + 1/S when looping for Q) were as large as the current value of the current variable (in the example, Q), they still would not complete the total of 1.
For example, 1/2 + 1/3 = 5/6 leaving 1/6 to go. How far does R need to go? Since 2/7 would be more than enough to cover the gap, as would 2/8, 2/9, 2/10, 2/11 or 2/12. But it would be useless to try 13 as a value for R as 2/13 would not amount to 1/6, much less 1/13 plus the reciprocal of an even higher number than 13.
The nominal endings of the loops were never reached, only the breaks based on the above method. P can never be above 5, etc. as the reciprocals after that could never reach a total of 1.
|
Posted by Charlie
on 2023-02-24 08:47:55 |