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

Home > Numbers
Armstrong plus one : Armstwo (Posted on 2021-12-27) Difficulty: 3 of 5
An Armstrong number is a positive integer that equals the sum of M-th powers of their digits when the number is M-digit long.
153 is an Armstrong number, since: 13+53+33=153.
Sloane's A005188 has an article on this, in which inter-alia it is mentioned that the sequence of Armstrong numbers terminates at the 88th term.

An Armstwo number is a base ten, M-digit long positive integer which is equal to the sum of M-th powers of one greater than each of the digits.
For example, if we check for 153, we find that:
23+63+43= 288, which is NOT equal to 153.

Determine the smallest Armstwo number.

**** Heartfelt thanks to Larry for inspiring this puzzle.

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 MATLAB solution | Comment 2 of 3 |
A small modification of the factoritwo program:

clearvars
for zeros=0:8
    z=repmat('0',1,zeros);
    for ones=0:8-zeros
        o=repmat('1',1,ones);
        for twos=0:8-zeros-ones
            t=repmat('2',1,twos);
            for threes=0:8-zeros-ones-twos
                th=repmat('3',1,threes);
                for fours=0:8-zeros-ones-twos-threes
                    fo=repmat('4',1,fours);
 for fives=0:8-zeros-ones-twos-threes-fours
    fi=repmat('5',1,fives) ;
    for sixes=0:8-zeros-ones-twos-threes-fours-fives
        sx=repmat('6',1,sixes);
        for sevens=0:8-zeros-ones-twos-threes-fours-fives-sixes
            sv=repmat('7',1,sevens);
            for eights=0:8-zeros-ones-twos-threes-fours-fives-sixes-sevens
                e=repmat('8',1,eights);
                for nines=0:8-zeros-ones-twos-threes-fours-fives-sixes-sevens-eights
                    ni=repmat('9',1,nines);
                    dig=[z o t th fo fi sx sv e ni];
                    if length(dig)>0
                        M=length(dig);
                    else
                        M=0;
                    end
                    tot=0;
                    for i=1:length(dig)
                        tot=tot+(str2double(dig(i))+1)^M;
                    end
                    tt=char(string(tot));
                    if isequal(sort(tt),sort(dig))
                       disp(tt); 
                    end
                end
            end
        end
    end
 end
                end
            end
        end
    end
end

checks up to 8-digit numbers but finds only 3-digit numbers:

251
141
560

The smallest is 141. 251 was found before it, as combinations with only one 1 were found before those with two 1's (within the case that no zeros were used).

  Posted by Charlie on 2021-12-27 11:31:01
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 (14)
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