Can $p^{q-1}\equiv 1 \pmod {q^3}$ for primes $p<q$? For prime $q$ can it be that
$$
p^{q-1}\equiv 1 \pmod{q^k}
$$
for some prime $p&lt;q$ and for $k\ge 3$?

There doesn't seem to be a case with $k=3$ and $q&lt;90000$, and I also checked for  small solutions with $3&lt;k\le 20$ and found none.

If we remove the condition $p&lt;q$ then there are always solutions, e.g. $15441^{16}\equiv 1 \pmod{17^5}$. Also for $k=2$ there are many, e.g. $71^{330} \equiv 1 \pmod {331^2}$.
Let $w&gt;1$ be any integer and let $q$ be an odd prime and $w^{q-1}$  $\equiv 1 \pmod {q^3}$. Let v be a primitive root mod $q^3$ where $v^h$  $\equiv w \pmod {q^3}$. So $v^{h(q-1)}$  $\equiv 1\pmod {q^3}$. Therefore h=$q^2 k$ ; k >= 1. Assume k> 1 , then $w^{(q-1)/k}$ $\equiv 1\pmod {q^3}$ ; $v^{q^2 k-k}$ $\equiv(w/v^k) \pmod {q^3}$ , so $v^{(q^2 k -k)(q^2)}$ $\equiv 1 \pmod {q^3}$ ,therefore $(w/v^k)^{q^2}$  $\equiv 1\pmod {q^3}$. If the order of w mod $q^3$ is M then given $(w/v)^{q^2 M} $ $ \equiv 1 \pmod {q^3}$ ; $v^{q^2 M}$ $\equiv 1 \pmod {q^3}$. Yet this implies M = (q-1).  Then the order of w mod $q^3$ is  not &lt;(q-1) contradiction. So k = 1. And $v^{q^2}$ $\equiv w \pmod q^3$. The order of w mod $q^3$ is (q-1). If w = p a prime &lt; q then $p^{q-1}$ $\equiv 1 \pmod {q^3}$ where (q-1) is the order of p. p = (q-v);  $(q-v)^q$ $\equiv(q-v)\pmod {q^3}$. So ($q^2$ $v^{q-1}$ -$v^q$) $\equiv(q-v)\pmod {q^3}$. Therefore $v^{q-1}$ ($q^2$-v) $\equiv (q-v)\pmod{q^3}$ ;  $(-v q)\equiv (q^2-v q)\pmod{q^3}$ ; $q^2 \equiv 0 \pmod{q^3}$ Contradiction , so if p &lt; q the order of p mod $q^3$ can not be (q-1)
Let $w&gt;1$ be any integer and let $q$ be an odd prime and $w^{q-1}$  $\equiv 1 \pmod {q^3}$. Let v be a primitive root mod $q^3$ where $v^h$  $\equiv w \pmod {q^3}$. So $v^{h(q-1)}$  $\equiv 1\pmod {q^3}$. Therefore h=$q^2 k$ ; k >= 1. Assume k> 1 , then $w^{(q-1)/k}$ $\equiv 1\pmod {q^3}$ ; $v^{q^2 k-k}$ $\equiv(w/v^k) \pmod {q^3}$ , so $v^{(q^2 k -k)(q^2)}$ $\equiv 1 \pmod {q^3}$ ,therefore $(w/v^k)^{q^2}$  $\equiv 1\pmod {q^3}$. If the order of w mod $q^3$ is M then given $(w/v)^{q^2 M} $ $ \equiv 1 \pmod {q^3}$ ; $v^{q^2 M}$ $\equiv 1 \pmod {q^3}$. Yet this implies M = (q-1).  Then the order of w mod $q^3$ is  not &lt;(q-1) contradiction. So k = 1. And $v^{q^2}$ $\equiv w \pmod q^3$. The order of w mod $q^3$ is (q-1). If w = p a prime &lt; q then $p^{q-1}$ $\equiv 1 \pmod {q^3}$ where (q-1) is the order of p. p = (q-v);  $(q-v)^q$ $\equiv(q-v)\pmod {q^3}$. So ($q^2$ $v^{q-1}$ -$v^q$) $\equiv(q-v)\pmod {q^3}$. Therefore $v^{q-1}$ ($q^2$-v) $\equiv (q-v)\pmod{q^3}$ ;  $(-v q)\equiv (q^2-v q)\pmod{q^3}$ ; $q^2 \equiv 0 \pmod{q^3}$ Contradiction , so if p &lt; q the order of p mod $q^3$ can not be (q-1)