Article snapshot taken from Wikipedia with creative commons attribution-sharealike license.
Give it a read and then ask your questions in the chat.
We can research this topic together.
In number theory, a perfect digit-to-digit invariant (PDDI; also known as a Munchausen number) is a natural number in a given number base that is equal to the sum of its digits each raised to the power of itself. An example in base 10 is 3435, because . The term "Munchausen number" was coined by Dutch mathematician and software engineer Daan van Berkel in 2009, as this evokes the story of Baron Munchausen raising himself up by his own ponytail because each digit is raised to the power of itself.
Definition
Let be a natural number which can be written in base as the k-digit number where each digit is between and inclusive, and . We define the function as . (As 0 is usually undefined, there are typically two conventions used, one where it is taken to be equal to one, and another where it is taken to be equal to zero.) A natural number is defined to be a perfect digit-to-digit invariant in base b if . For example, the number 3435 is a perfect digit-to-digit invariant in base 10 because .
for all , and thus 1 is a trivial perfect digit-to-digit invariant in all bases, and all other perfect digit-to-digit invariants are nontrivial. For the second convention where , both and are trivial perfect digit-to-digit invariants.
A natural number is a sociable digit-to-digit invariant if it is a periodic point for , where for a positive integer , and forms a cycle of period . A perfect digit-to-digit invariant is a sociable digit-to-digit invariant with . An amicable digit-to-digit invariant is a sociable digit-to-digit invariant with .
All natural numbers are preperiodic points for , regardless of the base. This is because all natural numbers of base with digits satisfy . However, when , then , so any will satisfy until . There are a finite number of natural numbers less than , so the number is guaranteed to reach a periodic point or a fixed point less than , making it a preperiodic point. This means also that there are a finite number of perfect digit-to-digit invariant and cycles for any given base .
The number of iterations needed for to reach a fixed point is the -factorion function's persistence of , and undefined if it never reaches a fixed point.
Perfect digit-to-digit invariants and cycles of Fb for specific b
The following program in Python determines whether an integer number is a Munchausen Number / Perfect Digit to Digit Invariant or not, following the convention .
num = int(input("Enter number:"))
temp = num
s = 0.0
while num > 0:
digit = num % 10
num //= 10
s+= pow(digit, digit)
if s == temp:
print("Munchausen Number")
else:
print("Not Munchausen Number")
def pddif(x: int, b: int) -> int:
total = 0
while x > 0:
total = total + pow(x % b, x % b)
x = x // b
return total
def pddif_cycle(x: int, b: int) -> list:
seen =
while x not in seen:
seen.append(x)
x = pddif(x, b)
cycle =
while x not in cycle:
cycle.append(x)
x = pddif(x, b)
return cycle
Convention 0 = 0
def pddif(x: int, b: int) -> int:
total = 0
while x > 0:
if x % b > 0:
total = total + pow(x % b, x % b)
x = x // b
return total
def pddif_cycle(x: int, b: int) -> list:
seen =
while x not in seen:
seen.append(x)
x = pddif(x, b)
cycle =
while x not in cycle:
cycle.append(x)
x = pddif(x, b)
return cycle
^ van Berkel, Daan (2009). "On a curious property of 3435". arXiv:0911.3038 .
Olry, Regis and Duane E. Haines. "Historical and Literary Roots of Münchhausen Syndromes", from Literature, Neurology, and Neuroscience: Neurological and Psychiatric Disorders, Stanley Finger, Francois Boller, Anne Stiles, eds. Elsevier, 2013. p.136.