The digital product P(N) of an integer N is the product of its decimal digits.
For example, P(128)=16.
Find all sets of three positive integers A, B and C such that:
A = P(B)+P(C)
B = P(A)+P(C)
C = P(A)+P(B).
for a=1:222
for b=a:222
for c=b:222
if a==pod(b)+pod(c)
if b==pod(a)+pod(c)
if c==pod(b)+pod(a)
disp([a b c])
end
end
end
end
end
end
where pod is
function pd = pod(n)
dgts=num2str(n) ;
pd=prod(dgts-'0');
end
>> digitalProductTriples
5 5 10
36 36 36
>>
These are the only two sets. Of course in the first, the 10 could be any of A, B or C.
|
Posted by Charlie
on 2023-09-05 09:35:07 |