The formula to calculate Euler Phi function

474 Views Asked by At

I know that $$\phi(m)=m\prod_{i=1}^{n}\left(1-\frac{1}{p_i}\right)\text{ Where }m=\prod_{i=1}^n p_i^{a_i}$$

But when i tried to find a formula of $\phi(n)$ i got this: $$\phi(m)=\phi \left(\prod_{i=1}^n p_i^{a_i}\right) = \prod_{i=1}^n \phi(p_i^{a_i}) $$ Now since $\phi(p^m)=p^m -p^{m-1}$, Thus: $$\phi(m)=\prod_{i=1}^n \left(p_i^{a_i}-p_i^{a_i-1}\right )$$

Is this’s a valid proof? and if it is why most people are using this formula: $$\phi(m)=m\prod_{i=1}^{n}\left(1-\frac{1}{p_i}\right) $$ Side note:

I’ve used the same method to find the formula of $\sigma(n)$ and $\sigma_m(n)$

2

There are 2 best solutions below

0
On BEST ANSWER

Your proof is valid (assuming you already proved the facts you used about $\phi$). Both formulas are practically equivalent

$$\prod_{i=1}^n (p_i^{a_i}-p_i^{a_i-1} ) =\prod_{i=1}^n p_i^{a_i}\left(1-\frac{1}{p_i}\right) = m \prod_{i=1}^n \left(1-\frac{1}{p_i}\right) $$

and both are widely used.

1
On

It would be worth writing this as $\phi(n)=n\prod_{p\in\Bbb P,\,p|n}(1-1/p)$. Your proof is the standard one, viz.$$\begin{align}\phi(n)&=\prod_{p\in\Bbb P,\,p|n}\phi(p^{\operatorname{ord}_p(n)})\\&=\prod_{p\in\Bbb P,\,p|n}p^{\operatorname{ord}_p(n)}(1-1/p)\\&=\prod_{p\in\Bbb P,\,p|n}p^{\operatorname{ord}_p(n)}\prod_{p\in\Bbb P,\,p|n}(1-1/p)\\&=n\prod_{p\in\Bbb P,\,p|n}(1-1/p).\end{align}$$