Determine a positive integer N such that the digits of N combined with the digits of N^2 are exactly the digits of N^3.
Extra credit: Find additional solutions, other than multiples of 10.
for n=1:10000
ns=unique(num2str(n));
n2s=unique(num2str(n^2));
n3s=unique(num2str(n^3));
tst=unique([ns n2s]);
if isequal(tst,n3s)
disp([n,n^2,n^3])
end
end
disp(' ')
for n=1:150000
ns= (num2str(n));
n2s= (num2str(n^2));
n3s= sort(num2str(n^3));
tst=sort([ns n2s]);
if isequal(tst,n3s)
disp([n,n^2,n^3])
end
end
If the number of occurrences doesn't matter:
n n^2 n^3
1 1 1
10 100 1000
100 10000 1000000
202 40804 8242408
1000 1000000 1000000000
2002 4008004 8024024008
2020 4080400 8242408000
2504 6270016 15700120064
2749 7557001 20774195749
3086 9523396 29389200056
3225 10400625 33542015625
3319 11015761 36561310759
3445 11868025 40885346125
4090 16728100 68417929000
4650 21622500 100544625000
4812 23155344 111423515328
4861 23629321 114862129381
5546 30758116 170584511336
5628 31674384 178263433152
6017 36204289 217841206913
6368 40551424 258231468032
6858 47032164 322546580712
6894 47527236 327652764984
7346 53963716 396417457736
7656 58614336 448751356416
8351 69739201 582392067551
8384 70291456 589323567104
8596 73891216 635168892736
8751 76580001 670151588751
8929 79727041 711882749089
8944 79995136 715476496384
9337 87179569 813995635753
9509 90421081 859814059229
10000 100000000 1000000000000
If a correct count matters:
6894 47527236 327652764984
68940 4752723600 327652764984000
|
Posted by Charlie
on 2024-04-25 09:09:26 |