Blog Image

The basics of Armstrong number


March 15, 2022 06:03PM Learn eTutorial
330

In number theory, a few numbers are termed as Armstrong Numbers in view of quite interesting behaviors that numbers exhibit.  This blog addresses the basics of Armstrong number for absolute beginners in the programming domain and for those who are interested in learning new aspects. So let's get started…

WHAT IS AN ARMSTRONG NUMBER

As per number theory, A number for any given number base can be defined as an Armstrong number when it returns the same number itself on the summation of the digits of the number each raised to the number of digits in the number. 

Armstrong number is also known as Narcissistic number or plus perfect number.

ARMSTRONG NUMBER  CONCEPT EXPLAINED

Let XYZ.. be a natural number with n digits and the number base be 10 (decimal number system) which is the commonly used number system. Other number systems can be binary with base 2, ternary with base 3, octal with base 8, and so on. To know more about the number system visit The number system.

Is XYZ.. an Armstrong number?

 XYZ..can be considered as an Armstrong number if and only if 

XYZ..  =   Xn + Yn + zn +....   =>   XYZ..

 Top IT Companies For Computer Science Graduates

ARMSTRONG NUMBER EXAMPLES

  1. Example 1:  Is 153 an Armstrong number if the base is 10 (decimal number system)?

    Here the number  153 is a 3 digit number in the decimal number system. 
    Base 10 numbering calculation is:
                     = 1 x 102 + 5 x 101 +3 x 100?
                     = 1 x 100 + 5 x 10 + 3 x 1  
                     = 100 + 50 + 3
                     = 153

    Now let's check if 153 is an Armstrong number or not. For that, we use the above formula with n equals 3.
                    = 13 + 53 + 33
                    = (1 x 1 x 1)+(5 x 5 x 5)+(3 x 3 x 3)
                    = 1 + 125 +27
                    = 153

    In both cases, we got the same digit on LHS and RHS. Thus we can prove that 153 is an Armstrong number with a base of 10.

  2. Example 2:  Is 122  an Armstrong number if the base is 3 (ternary number system)?

    Base 3 numbering calculation is:
                    = 1 x 32 + 2 x 32 +2 x 30  
                    =1 x  9 +2 x 3 + 2 x 1
                    = 9 + 6 + 1
                    = 17

    Now let's check if 122 is an Armstrong number or not in the base system 3. For that we use the above formula with n equals to 3.
                    = 13 + 23 + 23
                    = (1 x 1 x 1)+(2 x 2 x 2)+(2 x 2 x 2)
                    = 1 + 8 + 8
                    = 17

In both cases, we got 17 as the result and thus we prove that 122 is an Armstrong number with base 3.

From both examples, we can infer that an Armstrong number always exhibits the same property irrespective of the number system.          

SOME INTERESTING FACTS OF ARMSTRONG NUMBERS

  • All 1-digit numbers are Armstrong numbers in the decimal numbering system
  • There is no  2-digit Armstrong number in the decimal numbering system.
  • The smallest 3-digit Armstrong number in the decimal numbering system is 153. Other 3-digit Armstrong numbers are 370, 371 and 407
  • The smallest 4-digit Armstrong number in the decimal numbering system is 1634 and the other two Armstrong numbers with 4 digits are 8208 and 9474.
  • If you are interested in knowing more about Armstrong numbers in different number systems, Please visit Armstrong numbers with a different base.

ARMSTRONG NUMBERS AND PROGRAMMING

Check out our Armstrong programs in different programming languages.

Tutorial Study Image
Join Us