In number theory, a perfect digit-to-digit invariant (PDDI; also known as a Munchausen number[1]) 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.
The term "Munchausen number" was coined by Dutch mathematician and software engineer Daan van Berkel in 2009,[2] 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.
be a natural number which can be written in base
as the k-digit number
(As 00 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.
[5][6]) 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
, and thus 1 is a trivial perfect digit-to-digit invariant in all bases, and all other perfect digit-to-digit invariants are nontrivial.
are trivial perfect digit-to-digit invariants.
A natural number
is a sociable digit-to-digit invariant if it is a periodic point for
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
This is because all natural numbers of base
digits satisfy
, 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
to reach a fixed point is the
, and undefined if it never reaches a fixed point.
All numbers are represented in base
2 → 4 → 2011 → 12 → 10 → 2 104 → 2013 → 113 → 104 4 → 1104 → 1111 → 4 23445 → 24552 → 50054 → 50044 → 24503 → 23445 2 → 4 → 2011 → 11 → 2 9 → 2012 → 9 5 → 22245 → 23413 → 1243 → 1200 → 5 53 → 22332 → 150 → 22250 → 22305 → 22344 → 2311 → 53 The following program in Python determines whether an integer number is a Munchausen Number / Perfect Digit to Digit Invariant or not, following the convention
The examples below implement the perfect digit-to-digit invariant function described in the definition above to search for perfect digit-to-digit invariants and cycles in Python for the two conventions.