Aromstrong number in c programming…

YP
2 min readJan 10, 2020

--

#Wap to find Armstrong number..

Q: What is Armstrong number ?

Ans: In number theory, a narcissistic number ‘ in a given number base is a number that is the sum of its own digits each raised to the power of the number of digits.

A natural number {\displaystyle n}

is a sociable narcissistic number if it is a periodic point for {\displaystyle F_{b}}

, where {\displaystyle F_{b}^{p}(n)=n}

for a positive integer {\displaystyle p}

, and forms a cycle of period {\displaystyle p}

. A narcissistic number is a sociable narcissistic number with {\displaystyle p=1}

, and a amicable narcissistic number is a sociable narcissistic number with {\displaystyle p=2}.

All natural numbers {\displaystyle n}

are preperiodic points for {\displaystyle F_{b}}

, regardless of the base. This is because for any given digit count {\displaystyle k}

, the minimum possible value of {\displaystyle n}

is {\displaystyle b^{k-1}}

, the maximum possible value of {\displaystyle n}

is {\displaystyle b^{k}-1\leq b^{k}}

, and the narcissistic function value is {\displaystyle F_{b}(n)=k(b-1)^{k}}

. Thus, any narcissistic number must satisfy the inequality {\displaystyle b^{k-1}\leq k(b-1)^{k}\leq b^{k}}

. Multiplying all sides by {\displaystyle {\frac {b}{(b-1)^{k}}}}

, we get {\displaystyle {\left({\frac {b}{b-1}}\right)}^{k}\leq bk\leq b{\left({\frac {b}{b-1}}\right)}^{k}}

, or equivalently, {\displaystyle k\leq {\left({\frac {b}{b-1}}\right)}^{k}\leq bk}

. Since {\displaystyle {\frac {b}{b-1}}\geq 1}

, this means that there will be a maximum value {\displaystyle k}

where {\displaystyle {\left({\frac {b}{b-1}}\right)}^{k}\leq bk}

, because of the exponential nature of {\displaystyle {\left({\frac {b}{b-1}}\right)}^{k}}

and the linearity of {\displaystyle bk}.

Armstrong Number..

Beyond this value {\displaystyle k}

, {\displaystyle F_{b}(n)\leq n}

always. Thus, there are a finite number of narcissistic numbers, and any natural number is guaranteed to reach a periodic point or a fixed point less than {\displaystyle b^{k}-1}

, making it a preperiodic point. Setting {\displaystyle b}

equal to 10 shows that the largest narcissistic number in base 10 must be less than {\displaystyle 10^{60}}

.[1]

Program to find armstrong number…

Any doubt write in comment…

--

--

YP
YP

Written by YP

0 Followers

#PROGRAMMER

No responses yet