b
Let
n
b>1
Fb:N → N
Fb(n)=
k-1 | |
\sum | |
i=0 |
k. | |
d | |
i |
k=\lfloorlogb{n}\rfloor+1
b
di=
n\bmod{bi+1 | |
- |
n\bmodbi}{bi}
n
Fb
Fb(n)=n
0\leqn<b
b
For example, the number 153 in base
b=10
k=3
153=13+53+33
A natural number
n
Fb
p(n) | |
F | |
b |
=n
p
p | |
F | |
b |
p
Fb
p
p=1
p=2
All natural numbers
n
Fb
k
n
bk
n
bk-1\leqbk
Fb(n)=k(b-1)k
bk\leqk(b-1)k\leqbk
b | |
(b-1)k |
{\left( | b |
b-1 |
\right)}k\leqbk\leqb{\left(
b | |
b-1 |
\right)}k
k\leq{\left(
b | |
b-1 |
\right)}k\leqbk
b | |
b-1 |
\geq1
k
{\left( | b |
b-1 |
\right)}k\leqbk
{\left( | b |
b-1 |
\right)}k
bk
k
Fb(n)\leqn
bk-1
b
1060
The number of iterations
i
i | |
F | |
b |
(n)
n
A base
b
b2+1
b
\tau(b2+1)-2
\tau(n)
n
Every base
b\geq3
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, ...
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.
All numbers are represented in base
b
b | Narcissistic numbers | Cycles | OEIS sequence(s) | ||
---|---|---|---|---|---|
0, 1 | 2 | \varnothing | |||
0, 1, 2, 12, 22, 122 | 6 | \varnothing | |||
0, 1, 2, 3, 130, 131, 203, 223, 313, 332, 1103, 3303 | 12 | \varnothing | and | ||
0, 1, 2, 3, 4, 23, 33, 103, 433, 2124, 2403, 3134, 124030, 124031, 242423, 434434444, ... | 18 | 1234 → 2404 → 4103 → 2323 → 1234 3424 → 4414 → 11034 → 20034 → 20144 → 31311 → 3424 1044302 → 2110314 → 1044302 1043300 → 1131014 → 1043300 | |||
0, 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 | |||
0, 1, 2, 3, 4, 5, 6, 13, 34, 44, 63, 250, 251, 305, 505, 12205, 12252, 13350, 13351, 15124, 36034, 205145, 1424553, 1433554, 3126542, 4355653, 6515652, 125543055, ... | 60 | ||||
0, 1, 2, 3, 4, 5, 6, 7, 24, 64, 134, 205, 463, 660, 661, 40663, 42710, 42711, 60007, 62047, 636703, 3352072, 3352272, ... | 63 | and | |||
0, 1, 2, 3, 4, 5, 6, 7, 8, 45, 55, 150, 151, 570, 571, 2446, 12036, 12336, 14462, 2225764, 6275850, 6275851, 12742452, ... | 59 | ||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834, ... | 89 | ||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, 56, 66, 105, 307, 708, 966, A06, A64, 8009, 11720, 11721, 12470, ... | 135 | ||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, 25, A5, 577, 668, A83, 14765, 938A4, 369862, A2394A, ... | 88 | ||||
0, 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 | ||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, 136, 409, 74AB5, 153A632, ... | 103 | ||||
0, 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 | ||||
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, 8C0, 8C1, 99A, AA9, AC3, CA8, E69, EA0, EA1, B8D2, 13579, 2B702, 2B722, 5A07C, 5A47C, C00E0, C00E1, C04E0, C04E1, C60E7, C64E7, C80E0, C80E1, C84E0, C84E1, ... | 294 |
Narcissistic numbers can be extended to the negative integers by use of a signed-digit representation to represent each integer.
The example below implements the narcissistic function described in the definition above to search for narcissistic functions and cycles in Python.
def ppdif_cycle(x, b): seen = [] while x not in seen: seen.append(x) x = ppdif(x, b) cycle = [] while x not in cycle: cycle.append(x) x = ppdif(x, b) return cycleThe following Python program determines whether the integer entered is a Narcissistic / Armstrong number or not.
return i
def required_sum(num): i = no_of_digits(num) s = 0 while num > 0: digit = num % 10 num //= 10 s += pow(digit, i) return s
num = int(input("Enter number:"))s = required_sum(num) if s
The following Java program determines whether the integer entered is a Narcissistic / Armstrong number or not.
public class ArmstrongNumber
The following C# program determines whether the integer entered is a Narcissistic / Armstrong number or not.
public class Program
The following C program determines whether the integer entered is a Narcissistic / Armstrong number or not.
int getNumberOfDigits(int n);bool isArmstrongNumber(int candidate);
int main
bool isArmstrongNumber(int candidate)
int getNumberOfDigits(int n)
The following C++ program determines whether the Integer entered is a Narcissistic / Armstrong number or not.
bool isArmstrong(int n)int main
The following Ruby program determines whether the integer entered is a Narcissistic / Armstrong number or not.
The following JavaScript program determines whether the integer entered is a Narcissistic / Armstrong number or not.
The following Rust program prints all the Narcissistic / Armstrong numbers from 0 to 100 million in base 10.
fn main