Narcissistic number


In number theory, a narcissistic number, an Armstrong 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.

Definition

Let be a natural number. We define the narcissistic function for base to be the following:
where is the number of digits in the number in base, and
is the value of each digit of the number. A natural number is a narcissistic number if it is a fixed point for, which occurs if. The natural numbers are trivial narcissistic numbers for all, all other narcissistic numbers are nontrivial narcissistic numbers.
For example, the number 122 in base is a narcissistic number, because and.
A natural number is a sociable narcissistic number if it is a periodic point for, where for a positive integer, and forms a cycle of period. A narcissistic number is a sociable narcissistic number with, and a amicable narcissistic number is a sociable narcissistic number with.
All natural numbers are preperiodic points for, regardless of the base. This is because for any given digit count, the minimum possible value of is, the maximum possible value of is, and the narcissistic function value is. Thus, any narcissistic number must satisfy the inequality. Multiplying all sides by, we get, or equivalently,. Since, this means that there will be a maximum value where, because of the exponential nature of and the linearity of. Beyond this value, 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, making it a preperiodic point. Setting equal to 10 shows that the largest narcissistic number in base 10 must be less than.
The number of iterations needed for to reach a fixed point is the narcissistic function's persistence of, and undefined if it never reaches a fixed point.
A base has at least one two-digit narcissistic number if and only if is not prime, and the number of two-digit narcissistic numbers in base equals, where is the number of positive divisors of.
Every base that is not a multiple of nine has at least one three-digit narcissistic number. The bases that do not are
There are only 89 narcissistic numbers in base 10, of which the largest is
with 39 digits.

Narcissistic numbers and cycles of ''F''''b'' for specific ''b''

All numbers are represented in base. '#' is the length of each known finite sequence.
Narcissistic numbers#CyclesOEIS sequence
20, 12
30, 1, 2, 12, 22, 1226
40, 1, 2, 3, 130, 131, 203, 223, 313, 332, 1103, 330312 and
50, 1, 2, 3, 4, 23, 33, 103, 433, 2124, 2403, 3134, 124030, 124031, 242423,...18
1234 → 2404 → 4103 → 2323 → 1234
3424 → 4414 → 11034 → 20034 → 20144 → 31311 → 3424
1044302 → 2110314 → 1044302
1043300 → 1131014 → 1043300
60, 1, 2, 3, 4, 5, 243, 514, 14340, 14341, 14432, 23520, 23521, 44405, 435152, 5435254, 12222215, 555435035...31
44 → 52 → 45 → 105 → 330 → 130 → 44
13345 → 33244 → 15514 → 53404 → 41024 → 13345
14523 → 32253 → 25003 → 23424 → 14523
2245352 → 3431045 → 2245352
12444435 → 22045351 → 30145020 → 13531231 → 12444435
115531430 → 230104215 → 115531430
225435342 → 235501040 → 225435342
70, 1, 2, 3, 4, 5, 6, 13, 34, 44, 63, 250, 251, 305, 505, 12205, 12252, 13350, 13351, 15124, 36034,...60
80, 1, 2, 3, 4, 5, 6, 7, 24, 64, 134, 205, 463, 660, 661,...63 and
90, 1, 2, 3, 4, 5, 6, 7, 8, 45, 55, 150, 151, 570, 571, 2446, 12036, 12336, 14462,...59
100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834,...89
110, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, 56, 66, 105, 307, 708, 966, A06, A64, 8009, 11720, 11721, 12470,...135
120, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, 25, A5, 577, 668, A83, 14765, 938A4, 369862, A2394A,...88
130, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, 14, 36, 67, 77, A6, C4, 490, 491, 509, B85, 3964, 22593, 5B350,...202
140, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, 136, 409, 74AB5, 153A632,...103
150, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, 78, 88, C3A, D87, 1774, E819, E829, 7995C, 829BB, A36BC,...203
161, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 156, 173, 208, 248, 285, 4A5, 5B0, 5B1, 60B, 64B, 8C0, 8C1, 99A, AA9, AC3, CA8, E69, EA0, EA1,...294

Extension to negative integers

Narcissistic numbers can be extended to the negative integers by use of a signed-digit representation to represent each integer.

Programming example

The example below implements the narcissistic function described in the definition above to search for narcissistic functions and cycles in Python.

def ppdif:
y = x
digit_count = 0
while y > 0:
digit_count = digit_count + 1
y = y // b
total = 0
while x > 0:
total = total + pow
x = x // b
return total
def ppdif_cycle:
seen =
while x not in seen:
seen.append
x = ppdif
cycle =
while x not in cycle:
cycle.append
x = ppdif
return cycle