Totient of a Prime Power

Also known as phi p^k · euler totient prime power · totient of a power

φ(pk)=pk1(p1)\varphi(p^k) = p^{k-1}(p - 1)

Enter your known values, leave one input blank, and solves for the missing one. Try different units for next level excitement!

Learning zone

Counting the numbers below pkp^k that are coprime to it is easier than the general totient because there is only one prime to avoid. Of the pkp^k candidates, the ones sharing a factor are exactly the multiples of p, and there are pk1p^{k-1} of those. Subtract: pkpk1=pk1(p1)p^k - p^{k-1} = p^{k-1}(p-1). For 25=322^5 = 32 that is 16×1=1616 \times 1 = 16, which is just the odd numbers — every odd number below 32 is coprime to it, and there are 16.

Set k = 1 and the formula reduces to p1p - 1, the fact that everything below a prime is coprime to it. That special case is used constantly: it is why the multiplicative group mod p has p−1 elements, and therefore why Fermat's little theorem has the exponent it does.

Like the sum-of-divisors formula, this is a building block rather than a destination, because φ is multiplicative across coprime parts. φ(360)=φ(23)φ(32)φ(5)=4×6×4=96\varphi(360) = \varphi(2^3)\varphi(3^2)\varphi(5) = 4 \times 6 \times 4 = 96. Every factor there came from this one formula. And as always, p must actually be prime — the derivation counted "multiples of p" as the only numbers sharing a factor, which is false the moment p is composite.

Totient of a Prime Power
φ(pk)=pk1(p1)\varphi(p^k) = p^{k-1}(p - 1)
Where
  • pp= Prime
  • kk= Exponent
  • φ\varphi= Totient
Missing one of these? Work it out first, then come back