Determine all possible pairs (p, q) of base ten positive integers that satisfy this system of equations:
- arithmetic mean (p, q) = 10x+y
- geometric mean (p, q) = 10y+x
where, each of p and q is a nonzero base ten integer, with p≠q, and each of x and y is a base ten digit.
for p=1:500
for q=1:500
if p~=q
amean=(p+q)/2;
if amean==floor(amean) && amean>9 && amean < 100
gmean=sqrt(p*q);
if gmean==floor(gmean) && gmean<100
if floor(amean/10)==mod(gmean,10)
if floor(gmean/10)==mod(amean,10)
disp([p q (p+q)/2 sqrt(p*q)])
end
end
end
end
end
end
end
finds
mean
p q arith geom
32 98 65 56
98 32 65 56
|
Posted by Charlie
on 2023-03-19 10:41:38 |