Question about primitive roots of p and $p^2$

For an odd prime $p$, and any fixed primitive root $g$ of $p$, there is exactly one $k$ modulo $p$ such that $g+kp$ is not a primitive root of $p^2$.

Thus the number of primitive roots "missed" by $p^2$ is the number of primitive roots of $p$, which is $\varphi(\varphi(p))$.

I do not know of an exact characterization of the numbers that cannot be $\varphi(k)$ for some $k$, let alone the ones that cannot be $\varphi(\varphi(p))$. But the only odd value attained by $\varphi(k)$ is $1$. And there are plenty of even numbers that are not attained, for example $14$.


We can prove something more generic.

Statement : ord$_{p^s}a=d\implies$ord$_{p^{s+1}}a=d$ or $p\cdot d$.

Proof:

Let ord$_{p^{s+1}}(a)=D$ and

let ord$\displaystyle_{p^s}a=d\iff a^d\equiv 1\pmod {p^s}=1+p^sq$ where $q$ is some integer

$\implies a^D\equiv 1\pmod{p^{s+1}}\equiv 1\pmod{p^s}\implies d\mid D$ i.e., $D=d\cdot k_1$(say) where $k_1$ is a positive integer.

Now, $a^{pd}=(a^d)^p=(1+p^sq)^p=1+\binom p1p^sr+\text{terms divisible by }p^{2s}\equiv 1\pmod{p^{s+1}}$ for $2s\ge s+1\iff s\ge1$

$\implies D\mid p\cdot d,$ i.e., $p\cdot d=k_2\cdot D,$(say) where $k_1$ is a positive integer.

Mutiplying $p\cdot d\cdot D=k_2\cdot D\cdot d\cdot k_1\implies k_1\cdot k_2=p$

Case$\#1:$ If $k_1=1,k_2=p,D=d\cdot k_1=d$

Case$\#2:$ If $k_2=1,k_1=p,D=d\cdot k_1=p\cdot d$

$\implies$ord$_{p^s}a=d\implies$ord$_{p^{s+1}}a=d$ or $p\cdot d$.