This is from one of past papers:
Suppose $x \in \mathbb{Z} \setminus 35\mathbb{Z}$, and $x^{35}\equiv 5 \pmod{35} $. Find all the $x$ satisfying these conditions.
I find the equation somewhat related to Fermat's little theorem but clearly $5$ and $35$ are not coprime and they do not meet the requirement given. Many thanks if you can help me.
If we temporarily denote $y=x^{35}$, then you can use the following observation: $$y\equiv5\pmod{35} \iff y\equiv0\pmod{5} \quad\text{and}\quad y\equiv5\pmod{7}.$$ So you need to solve a system of two congruences: $$x^{35}\equiv0\pmod{5} \quad\text{and}\quad x^{35}\equiv5\pmod{7}.$$ The first one clearly implies that $x\equiv0\pmod{5}$. And the second one allows applying Fermat's Little Theorem. And then, knowing what $x$ is modulo both $5$ and $7$, you can find its unique value modulo $35$.
UPDATE: How do we solve the second congruence? First of all, we can exclude all multiples of $7$, which obviously don't satisfy it (think why). Now, for all $x$ coprime with $7$, since $7$ is a prime number, Fermat's Little Theorem says that $x^6\equiv1\pmod{7}$. Then one way to solve the congruence is to observe that $$x^{35}=x^{36}x^{-1}=\left(x^6\right)^6x^{-1}\equiv1^6x^{-1}=x^{-1}\pmod{7},$$ so we need to solve $x^{-1}\equiv5\pmod{7}$.