Camacho numbers are positive integers that are equal to the sum of their digits raised to each power from 1 to the number of digits. For a Camacho number $$n \in \mathbb{N}_0$$ that consists of the digits $$d_1 d_2 \ldots d_m$$, it must therefore hold that \[ \sum_{p=1}^{m} \left( d_1^p + d_2^p + \cdots + d_m^p \right) = n \]
For example, 336 is a Camacho number because \[ (3 + 3 + 6) + (3^2 + 3^2 + 6^2) + (3^3 + 3^3 + 6^3) = 336 \]
Write a function camacho_term that takes two integers $$n, p \in \mathbb{N}_0$$ (int). If $$n$$ consists of the digits $$d_1 d_2 \ldots d_m$$, the function must return the result (int) of the following expression: \[ d_1^p + d_2^p + \cdots + d_m^p \]
Write a function camacho_sum that takes an integer $$n \in \mathbb{N}_0$$ (int). If $$n$$ consists of the digits $$d_1 d_2 \ldots d_m$$, the function must return the result (int) of the following expression: \[ \sum_{p=1}^{m} \left( d_1^p + d_2^p + \cdots + d_m^p \right) \]
Write a function iscamacho that takes an integer $$n \in \mathbb{N}_0$$ (int). The function must return a Boolean value (bool) that indicates if $$n$$ is a Camacho number.
Write a function next_camacho that takes an integer $$n \in \mathbb{N}_0$$ (int). The function must return the smallest Camacho number (int) that is greater than $$n$$.
>>> camacho_term(336, 1)
12
>>> camacho_term(336, 2)
54
>>> camacho_term(336, 3)
270
>>> camacho_sum(336)
336
>>> camacho_sum(4538775)
4538775
>>> camacho_sum(183670618569)
499096875990
>>> iscamacho(336)
True
>>> iscamacho(4538775)
True
>>> iscamacho(183670618569)
False
>>> next_camacho(60)
90
>>> next_camacho(4537541)
4538775
>>> next_camacho(183670618569)
183670618662