HOME

TheInfoList



OR:

In
number theory Number theory (or arithmetic or higher arithmetic in older usage) is a branch of pure mathematics devoted primarily to the study of the integers and integer-valued functions. German mathematician Carl Friedrich Gauss (1777–1855) said, "Mat ...
, a narcissistic number''Perfect and PluPerfect Digital Invariants''
by Scott Moore
(also known as a pluperfect digital invariant (PPDI), an Armstrong number (after Michael F. Armstrong) or a plus perfect number) in a given
number base In a positional numeral system, the radix or base is the number of unique digits, including the digit zero, used to represent numbers. For example, for the decimal/denary system (the most common system in use today) the radix (base number) is t ...
b is a number that is the sum of its own digits each raised to the power of the number of digits.


Definition

Let n be a natural number. We define the narcissistic function for base b > 1 F_ : \mathbb \rightarrow \mathbb to be the following: : F_(n) = \sum_^ d_i^k. where k = \lfloor \log_ \rfloor + 1 is the number of digits in the number in base b, and : d_i = \frac is the value of each digit of the number. A natural number n is a narcissistic number if it is a fixed point for F_, which occurs if F_(n) = n. The natural numbers 0 \leq n < b are trivial narcissistic numbers for all b, all other narcissistic numbers are nontrivial narcissistic numbers. For example, the number 153 in base b = 10 is a narcissistic number, because k = 3 and 153 = 1^3 + 5^3 + 3^3. A natural number n is a sociable narcissistic number if it is a
periodic point In mathematics, in the study of iterated functions and dynamical systems, a periodic point of a function is a point which the system returns to after a certain number of function iterations or a certain amount of time. Iterated functions Given a ...
for F_, where F_^p(n) = n for a positive
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
p (here F_^p is the pth
iterate Iteration is the repetition of a process in order to generate a (possibly unbounded) sequence of outcomes. Each repetition of the process is a single iteration, and the outcome of each iteration is then the starting point of the next iteration. ...
of F_b), and forms a cycle of period p. A narcissistic number is a sociable narcissistic number with p = 1, and an amicable narcissistic number is a sociable narcissistic number with p = 2. All natural numbers n are preperiodic points for F_, regardless of the base. This is because for any given digit count k, the minimum possible value of n is b^, the maximum possible value of n is b^ - 1 \leq b^k, and the narcissistic function value is F_(n) = k(b-1)^k. Thus, any narcissistic number must satisfy the inequality b^ \leq k(b-1)^k \leq b^k. Multiplying all sides by \frac, we get ^ \leq bk \leq b^, or equivalently, k \leq ^ \leq bk. Since \frac \geq 1, this means that there will be a maximum value k where ^ \leq bk, because of the
exponential Exponential may refer to any of several mathematical topics related to exponentiation, including: *Exponential function, also: **Matrix exponential, the matrix analogue to the above *Exponential decay, decrease at a rate proportional to value *Expo ...
nature of ^ and the
linearity Linearity is the property of a mathematical relationship ('' function'') that can be graphically represented as a straight line. Linearity is closely related to '' proportionality''. Examples in physics include rectilinear motion, the linear ...
of bk. Beyond this value k, F_(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 b^ - 1, making it a preperiodic point. Setting b equal to 10 shows that the largest narcissistic number in base 10 must be less than 10^. The number of iterations i needed for F_^(n) to reach a fixed point is the narcissistic function's persistence of n, and undefined if it never reaches a fixed point. A base b has at least one two-digit narcissistic number
if and only if In logic and related fields such as mathematics and philosophy, "if and only if" (shortened as "iff") is a biconditional logical connective between statements, where either both statements are true or both are false. The connective is b ...
b^2 + 1 is not prime, and the number of two-digit narcissistic numbers in base b equals \tau(b^2+1)-2, where \tau(n) is the number of positive divisors of n. Every base b \geq 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, ... There are only 89 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.


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

All numbers are represented in base b. '#' is the length of each known finite sequence.


Extension to negative integers

Narcissistic numbers can be extended to the negative integers by use of a
signed-digit representation In mathematical notation for numbers, a signed-digit representation is a positional numeral system with a set of signed digits used to encode the integers. Signed-digit representation can be used to accomplish fast addition of integers because ...
to represent each integer.


Programming example


Python

The example below implements the narcissistic function described in the definition above to search for narcissistic functions and cycles in
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
. def ppdif(x, b): 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 % b, digit_count) x = x // b return total 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 cycle The following Python program determines whether the
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
entered is a Narcissistic / Armstrong number or not. def no_of_digits(num): i = 0 while num > 0: num //= 10 i+=1 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

num: print("Armstrong Number") else: print("Not Armstrong Number")


Java

The following
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
program determines whether the
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
entered is a Narcissistic / Armstrong number or not. import java.util.Scanner; public class ArmstrongNumber


C#

The following C# program determines whether the
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
entered is a Narcissistic / Armstrong number or not. using System; public class Program


C

The following C program determines whether the
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
entered is a Narcissistic / Armstrong number or not. #include #include #include int getNumberOfDigits(int n); bool isArmstrongNumber(int candidate); int main() bool isArmstrongNumber(int candidate) int getNumberOfDigits(int n)


C++

The following
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
program determines whether the
Integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
entered is a Narcissistic / Armstrong number or not. #include #include bool isNarcissistic(long n) int main()


Ruby

The following
Ruby A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called ...
program determines whether the
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
entered is a Narcissistic / Armstrong number or not. def narcissistic?(value) #1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153 nvalue = [] nnum = value.to_s nnum.each_char do , num, nvalue << num.to_i end sum = 0 i = 0 while sum <= value nsum = 0 nvalue.each_with_index do , num,idx, nsum += num ** i end if nsum

value return true else i += 1 sum += nsum end end return false end


See also

*
Arithmetic dynamics Arithmetic dynamics is a field that amalgamates two areas of mathematics, dynamical systems and number theory. Classically, discrete dynamics refers to the study of the iteration of self-maps of the complex plane or real line. Arithmetic dynamics is ...
* Dudeney number * Factorion *
Happy number In number theory, a happy number is a number which eventually reaches 1 when replaced by the sum of the square of each digit. For instance, 13 is a happy number because 1^2+3^2=10, and 1^2+0^2=1. On the other hand, 4 is not a happy number because ...
*
Kaprekar's constant In number theory, Kaprekar's routine is an iterative algorithm that, with each iteration, takes a natural number in a given number base, creates two new numbers by sorting the digits of its number by descending and ascending order, and subtracts th ...
*
Kaprekar number In mathematics, a natural number in a given number base is a p-Kaprekar number if the representation of its square in that base can be split into two parts, where the second part has p digits, that add up to the original number. The numbers are n ...
* Meertens number * Perfect digit-to-digit invariant * Perfect digital invariant * Sum-product number


References

* 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


External links




Armstrong Numbers

Armstrong Numbers in base 2 to 16


* {{Classes of natural numbers Arithmetic dynamics Base-dependent integer sequences