Perfect_digital_invariant

Perfect digital invariant

Perfect digital invariant

Add article description


In number theory, a perfect digital invariant (PDI) is a number in a given number base () that is the sum of its own digits each raised to a given power ().[1][2]

Definition

Let be a natural number. The perfect digital invariant function (also known as a happy function, from happy numbers) for base and power is defined as:

where is the number of digits in the number in base , and

is the value of each digit of the number. A natural number is a perfect digital invariant if it is a fixed point for , which occurs if . and are trivial perfect digital invariants for all and , all other perfect digital invariants are nontrivial perfect digital invariants.

For example, the number 4150 in base is a perfect digital invariant with , because .

A natural number is a sociable digital invariant if it is a periodic point for , where for a positive integer (here is the th iterate of ), and forms a cycle of period . A perfect digital invariant is a sociable digital invariant with , and a amicable digital invariant is a sociable digital invariant with .

All natural numbers are preperiodic points for , regardless of the base. This is because if , , 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.

Numbers in base lead to fixed or periodic points of numbers .

Proof

If , then the bound can be reduced. Let be the number for which the sum of squares of digits is largest among the numbers less than .

because

Let be the number for which the sum of squares of digits is largest among the numbers less than .

because

Let be the number for which the sum of squares of digits is largest among the numbers less than .

Let be the number for which the sum of squares of digits is largest among the numbers less than .

. Thus, numbers in base lead to cycles or fixed points of numbers .

The number of iterations needed for to reach a fixed point is the perfect digital invariant function's persistence of , and undefined if it never reaches a fixed point.

is the digit sum. The only perfect digital invariants are the single-digit numbers in base , and there are no periodic points with prime period greater than 1.

reduces to , as for any power , and .

For every natural number , if , and , then for every natural number , if , then , where is Euler's totient function.

Proof

Let

be a natural number with digits, where , and , where is a natural number greater than 1.

According to the divisibility rules of base , if , then if , then the digit sum

If a digit , then . According to Euler's theorem, if , . Thus, if the digit sum , then .

Therefore, for any natural number , if , and , then for every natural number , if , then .

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]

F2,b

By definition, any three-digit perfect digital invariant for with natural number digits , , has to satisfy the cubic Diophantine equation . has to be equal to 0 or 1 for any , because the maximum value can take is . As a result, there are actually two related quadratic Diophantine equations to solve:

when , and
when .

The two-digit natural number is a perfect digital invariant in base

This can be proven by taking the first case, where , and solving for . This means that for some values of and , is not a perfect digital invariant in any base, as is not a divisor of . Moreover, , because if or , then , which contradicts the earlier statement that .

There are no three-digit perfect digital invariants for , which can be proven by taking the second case, where , and letting and . Then the Diophantine equation for the three-digit perfect digital invariant becomes

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

F3,b

There are just four numbers, after unity, which are the sums of the cubes of their digits:

These are odd facts, very suitable for puzzle columns and likely to amuse amateurs, but there is nothing in them which appeals to the mathematician. (sequence A046197 in the OEIS)
G. H. Hardy, A Mathematician's Apology

By definition, any four-digit perfect digital invariant for with natural number digits , , , has to satisfy the quartic Diophantine equation . has to be equal to 0, 1, 2 for any , because the maximum value can take is . As a result, there are actually three related cubic Diophantine equations to solve

when
when
when

We take the first case, where .

b = 3k + 1

Let be a positive integer and the number base . Then:

  • is a perfect digital invariant for for all .
Proof

Let the digits of be , , and . Then

Thus is a perfect digital invariant for for all .

  • is a perfect digital invariant for for all .
Proof

Let the digits of be , , and . Then

Thus is a perfect digital invariant for for all .

  • is a perfect digital invariant for for all .
Proof

Let the digits of be , , and . Then

Thus is a perfect digital invariant for for all .

More information , ...

b = 3k + 2

Let be a positive integer and the number base . Then:

  • is a perfect digital invariant for for all .
Proof

Let the digits of be , , and . Then

Thus is a perfect digital invariant for for all .

More information , ...

b = 6k + 4

Let be a positive integer and the number base . Then:

  • is a perfect digital invariant for for all .
Proof

Let the digits of be , , and . Then

Thus is a perfect digital invariant for for all .

More information , ...

Fp,b

All numbers are represented in base .

More information , ...

Extension to negative integers

Perfect digital invariants can be extended to the negative integers by use of a signed-digit representation to represent each integer.

Balanced ternary

In balanced ternary, the digits are 1, −1 and 0. This results in the following:

  • With odd powers , reduces down to digit sum iteration, as , and .
  • With even powers , indicates whether the number is even or odd, as the sum of each digit will indicate divisibility by 2 if and only if the sum of digits ends in 0. As and , for every pair of digits 1 or −1, their sum is 0 and the sum of their squares is 2.

Relation to happy numbers

A happy number for a given base and a given power is a preperiodic point for the perfect digital invariant function such that the -th iteration of is equal to the trivial perfect digital invariant , and an unhappy number is one such that there exists no such .

Programming example

The example below implements the perfect digital invariant function described in the definition above to search for perfect digital invariants and cycles in Python. This can be used to find happy numbers.

def pdif(x: int, p: int, b: int) -> int:
    """Perfect digital invariant function."""
    total = 0
    while x > 0:
        total = total + pow(x % b, p)
        x = x // b
    return total

def pdif_cycle(x: int, p: int, b: int) -> list[int]:
    seen = []
    while x not in seen:
        seen.append(x)
        x = pdif(x, p, b)
    cycle = []
    while x not in cycle:
        cycle.append(x)
        x = pdif(x, p, b)
    return cycle

See also


References

  1. PDIs by Harvey Heinz

Share this article:

This article uses material from the Wikipedia article Perfect_digital_invariant, and is written by contributors. Text is available under a CC BY-SA 4.0 International License; additional terms may apply. Images, videos and audio are available under their respective licenses.