All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Powers of the Digits (Posted on 2023-08-18) Difficulty: 3 of 5
Let N be an integer expressed in decimal.
Let D(N) be the sum of the digits of N expressed in decimal.
Let S(N) be the sum of the squares of the digits of N expressed in decimal.
Let C(N) be the sum of the cubes of the digits of N expressed in decimal.

Find the smallest pandigital number N (that is, containing all of the digits 0 to 9) which contains D(N), S(N) and C(N).

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer-aided solution Comment 2 of 2 |
    d=[0:9];
    d1=sum(d);
    d2=sum(d.^2);
    d3=sum(d.^3);
    fprintf(' %5d %5d %5d ',d1,d2,d3)

   45   285  2025  (sums of digits, squares, cubes)
   
shows it can't be done with just 10 digits, as the single 2 would have to be followed by 8, 0 and 5 in different places.

Similar problems occur if one of the digits is allowed to repeat in an 11-digit number:

for a=0:9
    d=[0:9 a];
    d1=sum(d);
    d2=sum(d.^2);
    d3=sum(d.^3);
    fprintf('%1d    %5d %5d %5d ',a,d1,d2,d3)
end

repeat      sum of
digit  digs sqrs  cubes
0       45   285  2025
1       46   286  2026
2       47   289  2033
3       48   294  2052
4       49   301  2089
5       50   310  2150
6       51   321  2241
7       52   334  2368
8       53   349  2537
9       54   366  2754

So, allow two of the digits to repeat or one to triplicate:

for a=0:9
  for b=a:9
    d=[0:9 a b];
    d1=sum(d);
    d2=sum(d.^2);
    d3=sum(d.^3);
    fprintf('%1d %1d      %5d %5d %5d ',a,b,d1,d2,d3)
  end
end

I went through the output manually and found one that works, marked to the right of its line below:

extra
digits     D(N) S(N)  C(N)
0 0         45   285  2025
0 1         46   286  2026
0 2         47   289  2033
0 3         48   294  2052
0 4         49   301  2089
0 5         50   310  2150
0 6         51   321  2241
0 7         52   334  2368
0 8         53   349  2537
0 9         54   366  2754
1 1         47   287  2027
1 2         48   290  2034
1 3         49   295  2053
1 4         50   302  2090
1 5         51   311  2151
1 6         52   322  2242
1 7         53   335  2369
1 8         54   350  2538
1 9         55   367  2755
2 2         49   293  2041
2 3         50   298  2060
2 4         51   305  2097
2 5         52   314  2158
2 6         53   325  2249
2 7         54   338  2376
2 8         55   353  2545
2 9         56   370  2762
3 3         51   303  2079
3 4         52   310  2116
3 5         53   319  2177
3 6         54   330  2268
3 7         55   343  2395
3 8         56   358  2564
3 9         57   375  2781
4 4         53   317  2153
4 5         54   326  2214
4 6         55   337  2305
4 7         56   350  2432
4 8         57   365  2601
4 9         58   382  2818
5 5         55   335  2275
5 6         56   346  2366
5 7         57   359  2493  
5 8         58   374  2662
5 9         59   391  2879
6 6         57   357  2457
6 7         58   370  2584   1  2584 370  6679
6 8         59   385  2753
6 9         60   402  2970
7 7         59   383  2711
7 8         60   398  2880
7 9         61   415  3097
8 8         61   413  3049
8 9         62   430  3266
9 9         63   447  3483

I placed the unused digits from D(N), S(N) and C(N) to the left and right of the concatenated S(N) and C(N), from low to high. (The D(N), as you can see is incorporated in the C(N).)

So the pandigital in question is 125,843,706,679.

Edited on August 18, 2023, 1:20 pm
  Posted by Charlie on 2023-08-18 13:18:23

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information