Perfect digital invariant


In number theory, a perfect digital invariant is a number in a given number base that is the sum of its own digits each raised to a given power.

Definition

Let be a natural number. We define the perfect digital invariant function for base and power to be the following:
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, 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.
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.
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.

Perfect digital invariants of F_{2, b}

By definition, any three-digit perfect digital invariant for with natural number digits,, has to satisfy the cubic Diophantine equation. However, 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
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
However, for all values of. Thus, there are no solutions to the Diophantine equation, and there are no three-digit perfect digital invariants for.

Perfect digital invariants of ''F''3,''b''

By definition, any four-digit perfect digital invariant for with natural number digits,,, has to satisfy the quartic Diophantine equation. However, 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
We take the first case, where.

''b'' = 3''k'' + 1

Let be a positive integer and the number base. Then:
14130131203
27250251305
310370371407
413490491509
5165B05B160B
6196D06D170D
7227F07F180F
8258H08H190H
9289J09J1A0J

''b'' = 3''k'' + 2

Let be a positive integer and the number base. Then:
15103
28205
311307
414409
51750B
62060D
72370F
82680H
92990J

''b'' = 6''k'' + 4

Let be a positive integer and the number base. Then:
04021
110153
216285
3223B7
4284E9

Perfect digital invariants and cycles of ''F''''p'',''b'' for specific ''p'' and ''b''

All numbers are represented in base.
Nontrivial perfect digital invariantsCycles
2312, 222 → 11 → 2
24
2523, 334 → 31 → 20 → 4
265 → 41 → 25 → 45 → 105 → 42 → 32 → 21 → 5
2713, 34, 44, 632 → 4 → 22 → 11 → 2
16 → 52 → 41 → 23 → 16
2824, 64
4 → 20 → 4
5 → 31 → 12 → 5
15 → 32 → 15
2945, 55
58 → 108 → 72 → 58
75 → 82 → 75
2104 → 16 → 37 → 58 → 89 → 145 → 42 → 20 → 4
21156, 66
5 → 23 → 12 → 5
68 → 91 → 75 → 68
21225, A5
5 → 21 → 5
8 → 54 → 35 → 2A → 88 → A8 → 118 → 56 → 51 → 22 → 8
18 → 55 → 42 → 18
68 → 84 → 68
21314, 36, 67, 77, A6, C428 → 53 → 28
79 → A0 → 79
98 → B2 → 98
2141B → 8A → BA → 11B → 8B → D3 → CA → 136 → 34 → 1B
29 → 61 → 29
21578, 882 → 4 → 11 → 2
8 → 44 → 22 → 8
15 → 1B → 82 → 48 → 55 → 35 → 24 → 15
2B → 85 → 5E → EB → 162 → 2B
4E → E2 → D5 → CE → 17A → A0 → 6A → 91 → 57 → 4E
9A → C1 → 9A
D6 → DA → 12E → D6
216D → A9 → B5 → 92 → 55 → 32 → D
331222 → 22 → 121 → 101 → 2
3420, 21, 130, 131, 203, 223, 313, 332
35103, 43314 → 230 → 120 → 14
36243, 514, 105513 → 44 → 332 → 142 → 201 → 13
3712, 22, 250, 251, 305, 505
2 → 11 → 2
13 → 40 → 121 → 13
23 → 50 → 236 → 506 → 665 → 1424 → 254 → 401 → 122 → 23
51 → 240 → 132 → 51
160 → 430 → 160
161 → 431 → 161
466 → 1306 → 466
516 → 666 → 1614 → 552 → 516
38134, 205, 463, 660, 661662 → 670 → 1057 → 725 → 734 → 662
3930, 31, 150, 151, 570, 571, 1388
38 → 658 → 1147 → 504 → 230 → 38
152 → 158 → 778 → 1571 → 572 → 578 → 1308 → 660 → 530 → 178 → 1151 → 152
638 → 1028 → 638
818 → 1358 → 818
310153, 370, 371, 407
55 → 250 → 133 → 55
136 → 244 → 136
160 → 217 → 352 → 160
919 → 1459 → 919
31132, 105, 307, 708, 966, A06, A64
3 → 25 → 111 → 3
9 → 603 → 201 → 9
A → 82A → 1162 → 196 → 790 → 895 → 1032 → 33 → 4A → 888 → 1177 → 576 → 5723 → A3 → 8793 → 1210 → A
25A → 940 → 661 → 364 → 25A
366 → 388 → 876 → 894 → A87 → 1437 → 366
49A → 1390 → 629 → 797 → 1077 → 575 → 49A
312577, 668, A83, 11AA
313490, 491, 509, B8513 → 22 → 13
314136, 409
315C3A, D87
31623, 40, 41, 156, 173, 208, 248, 285, 4A5, 580, 581, 60B, 64B, 8C0, 8C1, 99A, AA9, AC3, CA8, E69, EA0, EA1
43
121 → 200 → 121
122 → 1020 → 122
441103, 33033 → 1101 → 3
452124, 2403, 3134
1234 → 2404 → 4103 → 2323 → 1234
2324 → 2434 → 4414 → 11034 → 2324
3444 → 11344 → 4340 → 4333 → 3444
46
47
4820, 21, 400, 401, 420, 421
49432, 2466
531020, 1021, 2102, 10121
54200
3 → 3303 → 23121 → 10311 → 3312 → 20013 → 10110 → 3
3311 → 13220 → 10310 → 3311

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:
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 -> int:
"""Perfect digital invariant function."""
total = 0
while x > 0:
total = total + pow
x = x // b
return total
def pdif_cycle -> List:
seen =
while x not in seen:
seen.append
x = pdif
cycle =
while x not in cycle:
cycle.append
x = pdif
return cycle