Perfect digital invariant

) that is the sum of its own digits each raised to a given power (

The perfect digital invariant function (also known as a happy function, from happy numbers) for base

is a perfect digital invariant if it is a fixed point for

are trivial perfect digital invariants for all

, all other perfect digital invariants are nontrivial perfect digital invariants.

is a sociable digital invariant if it is a periodic point for

lead to fixed or periodic points of numbers

lead to cycles or fixed points of numbers

to reach a fixed point is the perfect digital invariant function's persistence of

, and undefined if it never reaches a fixed point.

The only perfect digital invariants are the single-digit numbers in base

No upper bound can be determined for the size of perfect digital invariants in a given base and arbitrary power, and it is not currently known whether or not the number of perfect digital invariants for an arbitrary base is finite or infinite.

[1] By definition, any three-digit perfect digital invariant

has to satisfy the cubic Diophantine equation

As a result, there are actually two related quadratic Diophantine equations to solve: The two-digit natural number

is a perfect digital invariant in base This can be proven by taking the first case, where

is not a perfect digital invariant in any base, as

There are no three-digit perfect digital invariants for

Then the Diophantine equation for the three-digit perfect digital invariant becomes

Thus, there are no solutions to the Diophantine equation, and there are no three-digit perfect digital invariants for

There are just four numbers, after unity, which are the sums of the cubes of their digits: By definition, any four-digit perfect digital invariant

has to satisfy the quartic Diophantine equation

As a result, there are actually three related cubic Diophantine equations to solve We take the first case, where

be a positive integer and the number base

be a positive integer and the number base

be a positive integer and the number base

121 → 200 → 121 122 → 1020 → 122 1234 → 2404 → 4103 → 2323 → 1234 2324 → 2434 → 4414 → 11034 → 2324 3444 → 11344 → 4340 → 4333 → 3444 3 → 3303 → 23121 → 10311 → 3312 → 20013 → 10110 → 3 3311 → 13220 → 10310 → 3311 Perfect digital invariants can be extended to the negative integers by use of a signed-digit representation to represent each integer.

is a preperiodic point for the perfect digital invariant function

is equal to the trivial perfect digital invariant

The example below implements the perfect digital invariant function described in the definition above to search for perfect digital invariants and cycles in Python.