There are only 4 positive integers N such that
multiplying sod(N) by inverted(sod(N)) equals N.
The trivial number 1 qualifies !
The magic Ramanujan number 1729 qualifies as well ,
Since 19*91=1729
Now, find the missing two and prove that no other exist.
for n=1:5000000
digs=char(string(n));
s1=sod(n);
s2=flip(char(string(s1)));
if s1*str2double(s2)==n
disp(n)
end
end
function sd = sod(n)
s=0;
dgts=num2str(n) ;
l=length(dgts) ;
for i=1:l
s=s+str2double(dgts(i));
end
sd=s;
end
finds only
1
81
1458
1729
and in fact the checking to 5 million is overkill:
Maximum SODs are proportional to log(n), and the product of two SODs to the square of log(n). At five digit n, the maximum SOD is 9*5=45, whose square is 2025, and thus already too small to match a 5-digit number. This is all the more so for higher numbers of digits; for example (9*6)^2 = 2916, too small to match a 6-digit number.
|
Posted by Charlie
on 2021-12-30 09:08:52 |