Find all positive integers (a,b,c) such that
ab-c, bc-a, ca-b are all powers of 2.
clearvars
for tot=3:2000
for a=1:tot/3
for b=a:(tot-a)/2
c=tot-a-b;
s=[a b c];
p=prod(s);
good=true;
for i=1:3
tst=p/s(i)-s(i);
l=round(log2(tst));
if 2^l~=tst || l<0
good=false;
break
end
end
if good
disp(s)
end
end
end
end
finds these combinations:
2 2 2
2 2 3
3 5 7
2 6 11
The last two sets have three different values, in case that's an implied requirement, while the first two have members that include equal values.
|
Posted by Charlie
on 2025-03-16 09:43:47 |