How to count the numbers $n$ which $n\le p^e$ and $n$ is not coprime to$p^e$

130 Views Asked by At

To a prime $p$ and a natural number $n$, I want to find $\phi(n)$.

To count how many numbers are there which is less or equal to $p^e$ and coprime to $p$, I am trying to count all the numbers which are not comprime to $p$.

I divide the cases into consider the numbers $n$ whose $gcd(n,p^e)=p,p^2,...,p^e$.

But then things become messy. Could someone please, if possible, continue on this track to count how many numbers are there are less or equal then $p^e$, but not coprime to it?

Thanks in advance!

1

There are 1 best solutions below

3
On BEST ANSWER

A natural number $n$ fails to be prime to $p^e$ precisely when it is divisible by $p$.

And there are exactly $p^{e-1}$ integers $1\leq n\leq p^e$ which are divisible by $p$, namely the integers of the form $kp$ for $k=1,2,\dots,p^{e-1}$.