Find the next Armstrong number



Problem to find the next Armstrong number in given number.


If given number equal to the power of each and every digit with length of the given number and sum the powered value.That is called Armstrong number.Armstrong number full Explain



Example-1:


Input    : n = 15
Output   : 153    


Example-2:


Input    : n = 300
Output   : 370   







Solution





from itertools import count

n = 15

for i in count(n):

    s = str(i)

    sum = 0

    for j in s:

        sum += int(j)**len(s)

    if sum == int(s):

        print(sum)

        break



Output



153