In number theory, a perfect digital invariant (PDI) is a number in a given number base ( b {\displaystyle b} ) that is the sum of its own digits each raised to a given power ( p {\displaystyle p} ).
Definition Let n {\displaystyle n} be a natural number. The perfect digital invariant function (also known as a happy function, from happy numbers) for base b > 1 {\displaystyle b>1} and power p > 0 {\displaystyle p>0} F p , b : N → N {\displaystyle F_{p,b}:\mathbb {N} \rightarrow \mathbb {N} } is defined as:
F p , b ( n ) = ∑ i = 0 k − 1 d i p . {\displaystyle F_{p,b}(n)=\sum _{i=0}^{k-1}d_{i}^{p}.}
where k = ⌊ log b n ⌋ + 1 {\displaystyle k=\lfloor \log _{b}{n}\rfloor +1} is the number of digits in the number in base b {\displaystyle b} , and
d i = n mod b i + 1 − n mod b i b i {\displaystyle d_{i}={\frac {n{\bmod {b^{i+1}}}-n{\bmod {b}}^{i}}{b^{i}}}}
… excerpt ends here. Continue reading the full article.
