# Python Program to Check Armstrong (Narcissistic) Number

#### This python programs check whether a given positive integer number is Armstrong number or not. Armstrong number is also known as Narcissistic number.

A number is said to be Armstrong or Narcissistic Number if it is equal to the sum of its own digits raised to the power of the number of digits in a given number.

Armstrong Numbers Example, number 371 is Armstrong number because: 33 + 73 + 13 = 371

Similary, 8208 is also Armstrong number i.e. 84+24+04+24 = 8208

Single digits number 1 to 9 are also Armstrong numbers.

List of Armstrong Numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834, 1741725, 4210818, 9800817, 9926315, 24678050, 24678051, 88593477, 146511208, 472335975, 534494836, 912985153, 4679307774, ...

## Python Source Code: Check Armstrong or Narcissistic

``````
# Python program to check Armstrong

# Function to count digit in number
def count_digit(n):
count = 0
while n:
n //= 10
count += 1
return count

# Function to check Armstrong
def check_armstrong(n):
number_copy = n
arm_sum = 0
digit = count_digit(n)
while n:
remainder = n%10
arm_sum += remainder**digit
n //= 10

return arm_sum == number_copy

number = int(input('Enter number: '))

# Making decision
if check_armstrong(number):
print('%d is ARMSTRONG.' %(number))
else:
print('%d is NOT ARMSTRONG.' %(number))

``````

## Check Armstrong Python Output

```Run 1:
--------------
Enter number: 8208
8208 is ARMSTRONG.

Run 2:
--------------
Enter number: 1328
1328 is NOT ARMSTRONG.
```