[proofplan]
We compute $\varphi(p^a)$ directly from its definition as the number of integers between $1$ and $p^a$ that are relatively prime to $p^a$. Since $p$ is prime, an integer in this interval fails to be coprime to $p^a$ exactly when it is divisible by $p$. We then count those multiples of $p$ by an explicit bijection and subtract from the total number of integers in the interval.
[/proofplan]
custom_env
admin
[step:Identify the integers not coprime to $p^a$ as the multiples of $p$]Let
\begin{align*}
S := \{k \in \mathbb{N} : 1 \le k \le p^a\}
\end{align*}
be the set of positive integers at most $p^a$. Let
\begin{align*}
B := \{k \in S : \gcd(k,p^a)=1\}
\end{align*}
be the subset counted by Euler's totient function, and let
\begin{align*}
M := \{k \in S : p \mid k\}
\end{align*}
be the subset of multiples of $p$ in $S$.
We claim that $S \setminus B = M$. First, if $k \in M$, then $p \mid k$ and $p \mid p^a$, so $p$ is a common divisor of $k$ and $p^a$. Hence $\gcd(k,p^a) \ge p > 1$, and therefore $k \notin B$.
Conversely, suppose $k \in S \setminus B$. Then $\gcd(k,p^a)>1$. Since $\gcd(k,p^a)$ divides $p^a$ and $p$ is prime, every prime divisor of $\gcd(k,p^a)$ must be $p$. Thus $p \mid \gcd(k,p^a)$, and hence $p \mid k$. Therefore $k \in M$. This proves $S \setminus B = M$.[/step]
custom_env
admin
[guided]The set $B$ is exactly the set whose cardinality is $\varphi(p^a)$, so the main issue is to understand which integers are excluded from $B$. Define
\begin{align*}
S := \{k \in \mathbb{N} : 1 \le k \le p^a\}.
\end{align*}
Inside $S$, define
\begin{align*}
B := \{k \in S : \gcd(k,p^a)=1\}
\end{align*}
and
\begin{align*}
M := \{k \in S : p \mid k\}.
\end{align*}
We prove that the excluded integers $S \setminus B$ are exactly the multiples of $p$, namely $M$.
First suppose $k \in M$. Then $p \mid k$ by definition of $M$. Also $p \mid p^a$ because $a \in \mathbb{N}$, so $a \ge 1$. Therefore $p$ is a common divisor of $k$ and $p^a$. Since $p$ is prime, $p>1$, and so
\begin{align*}
\gcd(k,p^a) \ge p > 1.
\end{align*}
Thus $\gcd(k,p^a) \ne 1$, so $k \notin B$. This proves $M \subseteq S \setminus B$.
Conversely suppose $k \in S \setminus B$. Then $k \in S$ and $k \notin B$, so
\begin{align*}
\gcd(k,p^a)>1.
\end{align*}
The integer $\gcd(k,p^a)$ divides $p^a$. Because $p$ is prime, the prime factorisation of $p^a$ contains only the prime $p$. Hence any integer greater than $1$ dividing $p^a$ has $p$ as a prime divisor. Applying this to $\gcd(k,p^a)$ gives
\begin{align*}
p \mid \gcd(k,p^a).
\end{align*}
Since $\gcd(k,p^a)$ divides $k$, it follows that $p \mid k$. Therefore $k \in M$. This proves $S \setminus B \subseteq M$.
Combining the two inclusions gives
\begin{align*}
S \setminus B = M.
\end{align*}[/guided]
custom_env
admin
[step:Count the multiples of $p$ in the interval from $1$ to $p^a$]
Define a map
\begin{align*}
f: \{j \in \mathbb{N} : 1 \le j \le p^{a-1}\} \to M
\end{align*}
by
\begin{align*}
f(j) := jp.
\end{align*}
The map is well-defined because if $1 \le j \le p^{a-1}$, then $p \le jp \le p^a$ and $p \mid jp$.
The map $f$ is injective: if $f(j_1)=f(j_2)$, then $j_1p=j_2p$, and cancellation in $\mathbb{Z}$ gives $j_1=j_2$. It is surjective: if $k \in M$, then $k=jp$ for some $j \in \mathbb{N}$, and the inequalities $1 \le k \le p^a$ imply $1 \le j \le p^{a-1}$. Hence $f$ is a bijection, so
\begin{align*}
|M|=p^{a-1}.
\end{align*}
[/step]
custom_env
admin
[step:Subtract the non-coprime integers and factor the result]By definition of Euler's totient function,
\begin{align*}
\varphi(p^a)=|B|.
\end{align*}
Since $S$ has exactly $p^a$ elements and $S \setminus B=M$, we have
\begin{align*}
|B|=|S|-|M|.
\end{align*}
Using the count of $M$ from the previous step gives
\begin{align*}
\varphi(p^a)=p^a-p^{a-1}.
\end{align*}
Finally, in rational arithmetic,
\begin{align*}
p^a-p^{a-1}=p^a\left(1-\frac{1}{p}\right).
\end{align*}
Therefore
\begin{align*}
\varphi(p^a)=p^a-p^{a-1}=p^a\left(1-\frac{1}{p}\right).
\end{align*}[/step]
custom_env
admin
[guided]The last step is purely a counting subtraction. By definition of Euler's totient function, $\varphi(p^a)=|B|$, where $B$ is the set of integers in $S$ that are coprime to $p^a$. The set $S$ contains exactly $p^a$ integers, and the previous step established that the excluded integers are exactly $M$. Hence
\begin{align*}
|B|=|S|-|M|.
\end{align*}
Substituting $|S|=p^a$ and $|M|=p^{a-1}$ gives
\begin{align*}
\varphi(p^a)=p^a-p^{a-1}.
\end{align*}
To obtain the factorized form, we rewrite the second term as $p^a/p$. This gives
\begin{align*}
p^a-p^{a-1}=p^a\left(1-\frac{1}{p}\right).
\end{align*}
Therefore
\begin{align*}
\varphi(p^a)=p^a-p^{a-1}=p^a\left(1-\frac{1}{p}\right).
\end{align*}[/guided]