# Narcissistic number

(Redirected from Armstrong number)

In number theory, a narcissistic number[1][2] (also known as a pluperfect digital invariant (PPDI),[3] an Armstrong number[4] (after Michael F. Armstrong)[5] or a plus perfect number)[6] is a number that is the sum of its own digits each raised to the power of the number of digits. This definition depends on the base b of the number system used, e.g., b = 10 for the decimal system or b = 2 for the binary system.

## Definition

The definition of a narcissistic number relies on the decimal representation n = dkdk-1...d1 of a natural number n, i.e.,

n = dk·10k-1 + dk-1·10k-2 + ... + d2·10 + d1,

with k digits di satisfying 1 ≤ dk ≤ 9, and 0 ≤ di ≤ 9 for i < k. Such a number n is called narcissistic if it satisfies the condition

n = dkk + dk-1k + ... + d2k + d1k.

For example, the 3-digit decimal number 153 is a narcissistic number because 153 = 13 + 53 + 33.

Narcissistic numbers can also be defined with respect to numeral systems with a base b other than b = 10. The base-b representation of a natural number n is defined by

n = dkbk-1 + dk-1bk-2 + ... + d2b + d1,

where the base-b digits di satisfy the condition 0 ≤ di ≤ b-1. For example, the (decimal) number 17 is a narcissistic number with respect to the numeral system with base b = 3. Its three base-3 digits are 122, because 17 = 1·32 + 2·3 + 2 , and it satisfies the equation 17 = 13 + 23 + 23.

## Narcissistic numbers in various bases

The sequence of base 10 narcissistic numbers starts: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, ... (sequence A005188 in the OEIS)

The sequence of base 8 narcissistic numbers starts: 0, 1, 2, 3, 4, 5, 6, 7, 24, 64, 134, 205, 463, 660, 661, ... (sequence A010354 and A010351 in OEIS)

The sequence of base 12 narcissistic numbers starts: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, , Ɛ, 25, ᘔ5, 577, 668, ᘔ83, ... (sequence A161949 in the OEIS)

The sequence of base 16 narcissistic numbers starts: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 156, 173, 208, 248, 285, 4A5, 5B0, 5B1, 60B, 64B, ... (sequence A161953 in the OEIS)

The sequence of base 3 narcissistic numbers starts: 0, 1, 2, 12, 22, 122

The sequence of base 4 narcissistic numbers starts: 0, 1, 2, 3, 130, 131, 203, 223, 313, 332, 1103, 3303 (sequence A010344 and A010343 in OEIS)

In base 2, the only narcissistic numbers are 0 and 1.

The number of narcissistic numbers in a given base is finite, since the maximum possible sum of the kth powers of a k digit number in base b is

${\displaystyle k(b-1)^{k}\,,}$

and if k is large enough then

${\displaystyle k(b-1)^{k}

in which case no base b narcissistic number can have k or more digits. Setting b equal to 10 shows that the largest narcissistic number in base 10 must be less than 1060.[1]

There are only 88 narcissistic numbers in base 10, of which the largest is

115,132,219,018,763,992,565,095,597,973,971,522,401

with 39 digits.[1]

Clearly, in all bases, all one-digit numbers are narcissistic numbers.

A base b has at least one two-digit narcissistic number if and only if b2 + 1 is not prime, and the number of two-digit narcissistic numbers in base b equals ${\displaystyle \tau (b^{2}+1)-2}$, where ${\displaystyle \tau (n)}$ is the number of positive divisors of n.

Every base b ≥ 3 that is not a multiple of nine has at least one three-digit narcissistic number. The bases that do not are

2, 72, 90, 108, 153, 270, 423, 450, 531, 558, 630, 648, 738, 1044, 1098, 1125, 1224, 1242, 1287, 1440, 1503, 1566, 1611, 1620, 1800, 1935, ... (sequence A248970 in the OEIS)

Unlike narcissistic numbers, no upper bound can be determined for the size of PDIs in a given base, and it is not currently known whether or not the number of PDIs for an arbitrary base is finite or infinite.[2]

## Perfect digital invariant

Let ${\displaystyle n}$ be a natural number. We define the perfect digital invariant function for base ${\displaystyle b>1}$ and power ${\displaystyle p>0}$ ${\displaystyle F_{p,b}:\mathbb {N} \rightarrow \mathbb {N} }$ to be the following:

${\displaystyle F_{p,b}(n)=\sum _{i=0}^{k-1}d_{i}^{p}}$.

where ${\displaystyle k=\lfloor \log _{b}{n}\rfloor +1}$ is the number of digits in the number in base ${\displaystyle b}$, and

${\displaystyle d_{i}={\frac {n{\bmod {b^{i+1}}}-n{\bmod {b^{i}}}}{b^{i}}}}$

is the value of each digit of the number. A natural number ${\displaystyle n}$ is a perfect digital invariant if it is a fixed point for ${\displaystyle F_{p,b}}$, which occurs if ${\displaystyle F_{p,b}(n)=n}$.[2][7] ${\displaystyle 0}$ and ${\displaystyle 1}$ are trivial perfect digital invariants for all ${\displaystyle b}$ and ${\displaystyle p}$, all other perfect digital invariants are nontrivial perfect digital invariants.

For example, the number 4150 in base ${\displaystyle b=10}$ is a perfect digital invariant with ${\displaystyle p=5}$, because ${\displaystyle 4150=4^{5}+1^{5}+5^{5}+0^{5}}$.

A natural number ${\displaystyle n}$ is a sociable digital invariant if it is a periodic point for ${\displaystyle F_{p,b}}$, where ${\displaystyle F_{p,b}^{k}(n)=n}$ for a positive integer ${\displaystyle k}$, and forms a cycle of period ${\displaystyle k}$. A perfect digital invariant is a sociable digital invariant with ${\displaystyle k=1}$, and a amicable digital invariant is a sociable digital invariant with ${\displaystyle k=2}$.

All natural numbers ${\displaystyle n}$ are preperiodic points for ${\displaystyle F_{p,b}}$, regardless of the base. This is because if ${\displaystyle k\geq p+2}$, ${\displaystyle n\geq b^{k-1}>b^{p}k}$, so any ${\displaystyle n}$ will satisfy ${\displaystyle n>F_{b,p}(n)}$ until ${\displaystyle n. There are a finite number of natural numbers less than ${\displaystyle b^{p+1}}$, so the number is guaranteed to reach a periodic point or a fixed point less than ${\displaystyle b^{p+1}}$, making it a preperiodic point.

Numbers in base ${\displaystyle b>p}$ lead to fixed or periodic points of numbers ${\displaystyle n\leq (p-2)^{p}+p(b-1)^{p}}$.

${\displaystyle F_{1,b}}$ is the digit sum. The only perfect digital invariants are the single-digit numbers in base ${\displaystyle b}$, and there are no periodic points with prime period greater than 1.

${\displaystyle F_{p,2}}$ reduces to ${\displaystyle F_{1,2}}$, as for any power ${\displaystyle p}$, ${\displaystyle 0^{p}=0}$ and ${\displaystyle 1^{p}=1}$.

### Perfect digital invariants of ${\displaystyle F_{2,b}}$

By definition, any two-digit perfect digital invariant ${\displaystyle n}$ for ${\displaystyle F_{2,b}}$ with natural number digits ${\displaystyle 0\leq d_{0} has to satisfy the quadratic Diophantine equation ${\displaystyle d_{0}^{2}+d_{1}^{2}=d_{1}b+d_{0}}$.

There are no three-digit perfect digital invariants for ${\displaystyle F_{2,b}}$.

#### b = m2k + m + k

Let ${\displaystyle m,k}$ be positive integers and the number base ${\displaystyle b=m^{2}k+m+k}$. Then:

• ${\displaystyle n_{1}=kb+(mk+1)}$ is a perfect digital invariant for ${\displaystyle F_{2,b}}$ for all ${\displaystyle m,k}$
• ${\displaystyle n_{2}=(m^{2}k+m)b+(mk+1)}$ is a perfect digital invariant for ${\displaystyle F_{2,b}}$ for all ${\displaystyle m,k}$.

The table below gives the number base (in decimal) and the perfect digital invariants (in the number base) for every ${\displaystyle m<5,k<5}$.

Bases and Perfect digital invariants
${\displaystyle b_{10},n_{1},n_{2}}$ 1 2 3 4
1 3, 12, 22 5, 23, 33 7, 34, 44 9, 45, 55
2 7, 13, 63 12, 25, A5 17, 37, E7 22, 49, I9
3 13, 14, C4 23, 27, L7 33, 3A, UA 43, 4D, [39]D
4 21, 15, K5 38, 29, [36]9 55, 3D, [52]D 72, 4H, [68]H

#### b = Tk + 2 + (k2 + 4)m

Let ${\displaystyle m,k}$ be positive integers and the number base ${\displaystyle b=T_{k}+2+(k^{2}+4)m}$, where the triangular number ${\displaystyle T_{k}={\frac {k(k+1)}{2}}}$. Then:

• ${\displaystyle n_{1}=2(2m+1)b+((2m+1)k+1)}$ is a perfect digital invariant for ${\displaystyle F_{2,b}}$ for all ${\displaystyle m,k}$.
• ${\displaystyle n_{2}=(T_{k}+k^{2}m)b+((2m+1)k+1)}$ is a perfect digital invariant for ${\displaystyle F_{2,b}}$ for all ${\displaystyle m,k}$.

The table below gives the number base (in decimal) and the perfect digital invariants (in the number base) for every ${\displaystyle m<5,k<5}$.

Bases and Perfect digital invariants
${\displaystyle b_{10},n_{1},n_{2}}$ 1 2 3 4
1 3, 22, 12 5, 23, 33 8, 24, 64 12, 25, A5
2 8, 64, 24 13, 67, 77 21, 6A, FA 32, 6D, QD
3 13, A6, 36 21, AB, BB 34, AG, OG 52, AL, [42]L
4 18, E8, 48 29, EF, FF 57, EM, XM 72, ET, [58]T

### Perfect digital invariants of ${\displaystyle F_{3,b}}$

There are just four numbers, after unity, which are the sums of the cubes of their digits:
${\displaystyle 153=1^{3}+5^{3}+3^{3}}$
${\displaystyle 370=3^{3}+7^{3}+0^{3}}$
${\displaystyle 371=3^{3}+7^{3}+1^{3}}$
${\displaystyle 407=4^{3}+0^{3}+7^{3}}$.

These are odd facts, very suitable for puzzle columns and likely to amuse amateurs, but there is nothing in them which appeals to the mathematician.

— G. H. Hardy, A Mathematician's Apology

By definition, any four-digit perfect digital invariant ${\displaystyle n}$ for ${\displaystyle F_{3,b}}$ with natural number digits ${\displaystyle 0\leq d_{0}, ${\displaystyle 0\leq d_{1}, ${\displaystyle 0\leq d_{2}, ${\displaystyle 0\leq d_{3} has to satisfy the quartic Diophantine equation ${\displaystyle d_{0}^{3}+d_{1}^{3}+d_{2}^{3}+d_{3}^{3}=d_{3}b^{3}+d_{2}b^{2}+d_{1}b+d_{0}}$. However, ${\displaystyle d_{3}}$ has to be equal to 0, 1, 2 for any ${\displaystyle b>3}$, because the maximum value ${\displaystyle n}$ can take is ${\displaystyle n=(3-2)^{3}+3(b-1)^{3}=1+3(b-1)^{3}<3b^{3}}$. As a result, there are actually three related cubic Diophantine equations to solve

${\displaystyle d_{0}^{3}+d_{1}^{3}+d_{2}^{3}=d_{2}b^{2}+d_{1}b+d_{0}}$ when ${\displaystyle d_{3}=0}$
${\displaystyle d_{0}^{3}+d_{1}^{3}+d_{2}^{3}+1=b^{3}+d_{2}b^{2}+d_{1}b+d_{0}}$ when ${\displaystyle d_{3}=1}$
${\displaystyle d_{0}^{3}+d_{1}^{3}+d_{2}^{3}+8=2b^{3}+d_{2}b^{2}+d_{1}b+d_{0}}$ when ${\displaystyle d_{3}=2}$

We take the first case, where ${\displaystyle d_{3}=0}$.

#### b = 3k + 1

Let ${\displaystyle k}$ be a positive integer and the number base ${\displaystyle b=3k+1}$. Then:

• ${\displaystyle n_{1}=kb^{2}+(2k+1)b}$ is a perfect digital invariant for ${\displaystyle F_{3,b}}$ for all ${\displaystyle k}$.
• ${\displaystyle n_{2}=kb^{2}+(2k+1)b+1}$ is a perfect digital invariant for ${\displaystyle F_{3,b}}$ for all ${\displaystyle k}$.
• ${\displaystyle n_{3}=(k+1)b^{2}+(2k+1)}$ is a perfect digital invariant for ${\displaystyle F_{3,b}}$ for all ${\displaystyle k}$.
Perfect digital invariants
${\displaystyle k}$ ${\displaystyle b}$ ${\displaystyle n_{1}}$ ${\displaystyle n_{2}}$ ${\displaystyle n_{3}}$
1 4 130 131 203
2 7 250 251 305
3 10 370 371 407
4 13 490 491 509
5 16 5B0 5B1 60B
6 19 6D0 6D1 70D
7 22 7F0 7F1 80F
8 25 8H0 8H1 90H
9 28 9J0 9J1 A0J

#### b = 6k + 4

Let ${\displaystyle k}$ be a positive integer and the number base ${\displaystyle b=6k+4}$. Then:

• ${\displaystyle n_{4}=kb^{2}+(3k+2)b+(2k+1)}$ is a perfect digital invariant for ${\displaystyle F_{3,b}}$ for all ${\displaystyle k}$.
Perfect digital invariants
${\displaystyle k}$ ${\displaystyle b}$ ${\displaystyle n_{4}}$
0 4 021
1 10 153
2 16 285
3 22 3B7
4 28 4E9

### Perfect digital invariants and cycles of ${\displaystyle F_{p,b}}$ for specific ${\displaystyle p}$ and ${\displaystyle b}$

All numbers are represented in base ${\displaystyle b}$.

${\displaystyle p}$ ${\displaystyle b}$ Nontrivial perfect digital invariants Cycles Comments
2 3 12, 22 2 → 11 → 2
• All ${\displaystyle n\equiv 0{\bmod {2}}}$ terminate at the fixed point 22 or at the cycle starting with ${\displaystyle 2}$.
2 4 ${\displaystyle \varnothing }$ ${\displaystyle \varnothing }$
2 5 23, 33 4 → 31 → 20 → 4
2 6 ${\displaystyle \varnothing }$ 5 → 41 → 25 → 45 → 105 → 42 → 32 → 21 → 5
2 7 13, 34, 44, 63 2 → 4 → 22 → 11 → 2

16 → 52 → 41 → 23 → 16

2 8 24, 64

4 → 20 → 4

5 → 31 → 12 → 5

15 → 32 → 15

2 9 45, 55 58 → 108 → 72 → 58

75 → 82 → 75

2 10 ${\displaystyle \varnothing }$ 4 → 16 → 37 → 58 → 89 → 145 → 42 → 20 → 4
2 11 56, 66 5 → 23 → 12 → 5

68 → 91 → 75 → 68

2 12 25, A5

5 → 21 → 5

8 → 54 → 35 → 2A → 88 → A8 → 118 → 56 → 51 → 22 → 8

18 → 55 → 42 → 18

68 → 84 → 68

2 13 14, 36, 67, 77, A6, C4 28 → 53 → 28

79 → A0 → 79

98 → B2 → 98

2 14 ${\displaystyle \varnothing }$ 1B → 8A → BA → 11B → 8B → D3 → CA → 136 → 34 → 1B

29 → 61 → 29

2 15 78, 88 2 → 4 → 11 → 2

8 → 44 → 22 → 8

15 → 1B → 82 → 48 → 55 → 35 → 24 → 15

2B → 85 → 5E → EB → 162 → 2B

4E → E2 → D5 → CE → 17A → A0 → 6A → 91 → 57 → 4E

9A → C1 → 9A

D6 → DA → 12E → D6

2 16 ${\displaystyle \varnothing }$ D → A9 → B5 → 92 → 55 → 32 → D
3 3 ${\displaystyle 122}$ ${\displaystyle 2\rightarrow 22\rightarrow 121\rightarrow 101\rightarrow 2}$
• All ${\displaystyle n\equiv 0{\bmod {2}}}$ terminate at the cycle starting with ${\displaystyle 2}$.
3 4 ${\displaystyle 20,21,130,131,203,223,313,332}$ ${\displaystyle \varnothing }$
• All ${\displaystyle n\equiv 0{\bmod {3}}}$ terminate at ${\displaystyle 21}$.
• All ${\displaystyle n\equiv 2{\bmod {3}}}$ terminate at ${\displaystyle 20,131,203}$ or ${\displaystyle 332}$.
3 6 ${\displaystyle 243,514,1055}$

${\displaystyle 13\rightarrow 44\rightarrow 332\rightarrow 142\rightarrow 201\rightarrow 13}$

• ${\displaystyle 6^{3}=5^{3}+4^{3}+3^{3}}$
3 10 ${\displaystyle 153,370,371,407}$

${\displaystyle 133\rightarrow 55\rightarrow 250\rightarrow 133}$

${\displaystyle 217\rightarrow 352\rightarrow 160\rightarrow 217}$

${\displaystyle 1459\rightarrow 919\rightarrow 1459}$

${\displaystyle 136\rightarrow 244\rightarrow 136}$

• (sequence A046197 in the OEIS)
• All ${\displaystyle n\equiv 0{\bmod {3}}}$ terminate at ${\displaystyle 153}$.
• All ${\displaystyle n\equiv 2{\bmod {3}}}$ terminate at ${\displaystyle 371}$ or ${\displaystyle 407}$.
4 3 ${\displaystyle \varnothing }$

121 → 200 → 121

122 → 1020 → 122

• All ${\displaystyle n\equiv 0{\bmod {2}}}$ terminate at the cycle starting with ${\displaystyle 121}$.
4 4 ${\displaystyle 1103,3303}$ 3 → 1101 → 3
4 6

214 → 1133 → 432 → 1345 → 4243 → 2345 → 4310 → 1322 → 310 → 214

3 → 213 → 242 → 1200 → 25 → 2545 → 11014 → 1111 → 4 → 1104 → 1110 → 3

5350 → 10055 → 5443 → 5350

• Only done for ${\displaystyle n<101}$
4 10 ${\displaystyle 1634,8208,9474}$

2178 → 6514 → 2178

1138 → 4179 → 9219 → 13139 → 6725 → 4338 → 4514 → 1138

• Only done for ${\displaystyle n<101}$
5 3 ${\displaystyle 1020,1021,2102,10121}$ ${\displaystyle \varnothing }$
• All ${\displaystyle n\equiv 0{\bmod {2}}}$ terminate at ${\displaystyle 1021}$.
5 4 ${\displaystyle 200}$

3 → 3303 → 23121 → 10311 → 3312 → 20013 → 10110 → 3

3311 → 13220 → 10310 → 3311

• All ${\displaystyle n\equiv 0{\bmod {3}}}$ terminate at the cycle starting with ${\displaystyle 3}$.
• All ${\displaystyle n\equiv 1{\bmod {3}}}$ terminate at ${\displaystyle 1}$.
• All ${\displaystyle n\equiv 2{\bmod {3}}}$ terminate at ${\displaystyle 200}$ or the cycle starting with ${\displaystyle 3311}$.

### Extension to negative integers

Perfect digital invariants can be extended to the negative integers by use of a balanced base to represent each integer.

#### Balanced ternary

In balanced ternary, the digits are 1, −1 and 0. This results in the following:

• With odd powers ${\displaystyle p\equiv 1{\bmod {2}}}$, ${\displaystyle F_{p,{\text{bal}}3}}$ reduces down to digit sum iteration, as ${\displaystyle {(-1)}^{p}=-1}$, ${\displaystyle 0^{p}=0}$ and ${\displaystyle 1^{p}=1}$.
• With even powers ${\displaystyle p\equiv 0{\bmod {2}}}$, ${\displaystyle F_{p,{\text{bal}}3}}$ indicates whether the number is even or odd, as the sum of each digit will indicate divisibility by 2 if and only if the sum of digits ends in 0. As ${\displaystyle 0^{p}=0}$ and ${\displaystyle {(-1)}^{p}=1^{p}=1}$, for every pair of digits 1 or −1, their sum is 0 and the sum of their squares is 2.

## Related concepts

The term "narcissistic number" is sometimes used in a wider sense to mean a number that is equal to any mathematical manipulation of its own digits ${\displaystyle F_{b}:\mathbb {N} ^{k}\rightarrow \mathbb {N} }$:

${\displaystyle n=F_{b}\left(\bigcup _{i=0}^{k-1}\left\{d_{i}\right\}\right)}$,

where ${\displaystyle k=\lfloor \log _{b}{n}\rfloor +1}$ is the number of digits in the number in base ${\displaystyle b}$, and ${\displaystyle d_{i}={\frac {n{\bmod {b^{i+1}}}-n{\bmod {b^{i}}}}{b^{i}}}}$ is the value of each digit of the number. ${\displaystyle n}$ is a fixed point of ${\displaystyle F_{b}}$. With this wider definition narcisstic numbers include:

### Sums of unary operators on digits

${\displaystyle n=\sum _{i=0}^{k-1}F_{b}(d_{i})}$

where ${\displaystyle F_{b}}$ is a unary operator or a function, ${\displaystyle k=\lfloor \log _{b}{n}\rfloor +1}$ is the number of digits in the number in base ${\displaystyle b}$, and ${\displaystyle d_{i}={\frac {n{\bmod {b^{i+1}}}-n{\bmod {b^{i}}}}{b^{i}}}}$ is the value of each digit of the number.

### Products of unary operators on digits

${\displaystyle n=\prod _{i=0}^{k-1}F_{b}(d_{i})}$

where ${\displaystyle F_{b}}$ is a unary operator or a function, ${\displaystyle k=\lfloor \log _{b}{n}\rfloor +1}$ is the number of digits in the number in base ${\displaystyle b}$, and ${\displaystyle d_{i}={\frac {n{\bmod {b^{i+1}}}-n{\bmod {b^{i}}}}{b^{i}}}}$ is the value of each digit of the number.

• Numbers ${\displaystyle n}$ (sequence A282782 in the OEIS) such that: ${\displaystyle n=\prod _{i=0}^{k-1}d_{i}^{k-i}}$

### Functions of digit sums and products

${\displaystyle n=F_{b}\left(\sum _{i=0}^{k-1}d_{i}\right)}$

where ${\displaystyle F_{b}}$ is a unary operator or a function, ${\displaystyle k=\lfloor \log _{b}{n}\rfloor +1}$ is the number of digits in the number in base ${\displaystyle b}$, and ${\displaystyle d_{i}={\frac {n{\bmod {b^{i+1}}}-n{\bmod {b^{i}}}}{b^{i}}}}$ is the value of each digit of the number.

• Dudeney numbers (sequence A061209 in the OEIS) : ${\displaystyle n=\left(\sum _{i=0}^{k-1}{d_{i}}\right)^{3}}$
• Numbers ${\displaystyle n}$ (sequence A282693 in the OEIS) such that: ${\displaystyle n={\left(\sum _{i=0}^{k-1}d_{i}\right)}^{2}+\sum _{i=0}^{k-1}d_{i}}$
• Sum-product numbers (sequence A038369 in the OEIS) : ${\displaystyle n=\left(\sum _{i=0}^{k-1}{d_{i}}\right)\left(\prod _{i=0}^{k-1}{d_{i}}\right)}$

## References

1. ^ a b c Weisstein, Eric W. "Narcissistic Number". MathWorld.
2. ^ a b c Perfect and PluPerfect Digital Invariants Archived 2007-10-10 at the Wayback Machine by Scott Moore
3. ^ PPDI (Armstrong) Numbers by Harvey Heinz
4. ^ Armstrong Numbers by Dik T. Winter
5. ^ Lionel Deimel’s Web Log
6. ^ (sequence A005188 in the OEIS)
7. ^ PDIs by Harvey Heinz
8. ^ Rose, Colin (2005), Radical Narcissistic Numbers, Journal of Recreational Mathematics, 33(4), pages 250-254.
• Joseph S. Madachy, Mathematics on Vacation, Thomas Nelson & Sons Ltd. 1966, pages 163-175.
• Rose, Colin (2005), Radical narcissistic numbers, Journal of Recreational Mathematics, 33(4), 2004-2005, pages 250-254.
• Perfect Digital Invariants by Walter Schneider