Solution (source code)

= Solution
{c}

A <primitive root> modulo $p$ is an <integer> whose residue generates the multiplicative group $\mathbb F_p^\times$, equivalently has order $p-1$.

The <Chinese remainder theorem> states that, for pairwise coprime positive <integers> $m_1,\ldots,m_r$, the system $x\equiv a_i\pmod{m_i}$ has a unique solution modulo $M=\prod_i m_i$. For a constructive proof put $M_i=M/m_i$. Bézout's identity gives an <integer> $u_i$ with $M_i u_i\equiv1\pmod{m_i}$. Then $x=\sum_i a_iM_i u_i$ has all the required residues. If two solutions exist, their difference is divisible by every $m_i$; pairwise <coprimality> makes it divisible by their product, proving uniqueness modulo $M$.

Here $3,5,7$ divide $p-1$, and none is zero modulo $p$. Choose a <primitive root> $g$ and exponents $a,b,c$ with
$$
3\equiv g^a,\qquad5\equiv g^b,\qquad7\equiv g^c\pmod p.
$$
Use the theorem with moduli $3,5,7$ to choose $r$ such that $r\equiv a\pmod3$, $r\equiv b\pmod5$, $r\equiv c\pmod7$. Define nonzero residues
$$
n=g^r,\qquad x=g^{(r-a)/3},\qquad
y=g^{(r-b)/5},\qquad z=g^{(r-c)/7}.
$$
The exponents are <integers>; negative ones are interpreted using inverses in $\mathbb F_p^\times$. Taking <integer> representatives now gives
$$
\boxed{p\nmid n,\qquad n\equiv3x^3\equiv5y^5\equiv7z^7\pmod p.}
$$
The theorem aligns the exponent <modular congruences>, which is why a <primitive root> converts the three power conditions into a linear <modular congruence> problem.