I'm not sure I buy the theorem, unless $\displaystyle p$ is a prime. Is that a convention in number theory? If so, I would probably write out the prime factorization of $\displaystyle a$ and go from there.
Yes, $\displaystyle p$ usually stands for a prime number in elementary number theory.