Let N=d
1d
2d
3...d
n be an n-digit decimal number, with n>1.
Form the sum:
S(N) = d1n + d2n+ d3n + ... + dnn
Prove that there are only a finite number of integers N for which S(N)=N.
For an extra credit, find these values of N.
(In reply to
Some numbers but without a proof by Larry)
This version of the algorithm checks only sets of digits in numeric order, rather than all numbers in a range; it then takes the sum of the powers of the digits and sees if the sorted digits of the answer match the tested set.
This compensates for the slowness of Matlab as a language, but has the effect of finding the numbers in an order different from their numerical value, as it's the order of their sorted digits.
It was done for n=3 through n=11 and holds the answer set in an array that's shown sorted at the end.
answerSet=[];
for n=3:11
idx=combinator(9+n,9,'c');
for i=1:length(idx)
c=[0 idx(i,:) 10+n];
c2=c(2:end)-c(1:end-1 )-1;
ix=find(c2) ;
digs='';
for j=1:length(ix)
digs=[digs repmat(num2str(ix(j)-1),1,c2(ix(j)))];
end
if isequal(digs,'135')
xx=9;
end
dign=[];
for j=1:length(ix)
dign=[dign repmat( ix(j)-1,1,c2(ix(j)))];
end
v=sort(num2str(sum(dign.^n)));
if isequal(v,digs)
disp(sum(dign.^n));
answerSet(end+1)=sum(dign.^n);
end
end
end
disp(' ')
answerSet=sort(answerSet);
fprintf('%12d\n',answerSet);
>> powerDigits
371
153
407
370
9474
1634
8208
54748
92727
93084
548834
9926315
1741725
4210818
9800817
88593477
24678051
24678050
534494836
472335975
912985153
146511208
4679307774
82693916578
44708635679
94204591914
32164049651
49388550606
42678290603
40028394225
32164049650
153
370
371
407
1634
8208
9474
54748
92727
93084
548834
1741725
4210818
9800817
9926315
24678050
24678051
88593477
146511208
472335975
534494836
912985153
4679307774
32164049650
32164049651
40028394225
42678290603
44708635679
49388550606
82693916578
94204591914
|
Posted by Charlie
on 2024-03-16 08:13:30 |