# Find all primes $p \geq 5$ such that $6^p \cdot (p - 4)! + 10^{3p}$ is divisible by $p$

Find all primes $$p \geq 5$$ such that $$6^p \cdot (p - 4)! + 10^{3p}$$ is divisible by $$p$$

I've tried this : First check $$(p - 4)!:$$ \begin{align*} (p - 1)! &\equiv -1 \text{(mod p)}\tag{by Wilson's Theorem} \\ (p - 1)(p - 2)(p - 3)(p - 4)! &\equiv -1 \text{(mod p)} \\ (-1)(-2)(-3)(p - 4)! &\equiv -1 \text{(mod p)} \\ 6(p - 4)! &\equiv 1 \end{align*} By Fermat's Little Theorem, $$6^{p - 1} \equiv 1$$ (mod p), since $$5 \nmid 6$$ and the next primes are all greater than 6, so no prime $$p \geq 5$$ can divide 6. Then \begin{align*} 6^{p - 1}6(p - 4)! &\equiv 1 \text{(mod p)} \\ 6^p(p - 4)! &\equiv 1 \text{(mod p)} \end{align*} Now how would I apply Fermat's Little Theorem on $$10^{3p}$$? I've tried writing it as $$(10^p)^3$$, but since $$5\mid 10$$, it doesnt work. Would I discard the case when $$p = 5$$ to be able to use the theorem?

• A better version of Fermat's little theorem to use here is that $a^p\equiv a$ mod $p$ for all $a$ (even ones that are divisible by $p$). Feb 2, 2020 at 18:15
• $10^{3p}=1000^p\equiv 1000\pmod{p}$ Feb 2, 2020 at 18:25

As suggested by barry you need to find $$p$$ such that $$p|1000+6.(p-4)!\implies p|1000 (p-1)(p-2)(p-3)+6(p-1)!\implies p| 1000(p-1)(p-2)(p-3)-6\implies p|6006$$

can you do the rest? or should i show you further?

• Wouldn't I need to find a $p$ such that $p\nmid 1000$, since that is the assumption in Fermat's little theorem?
– java
Feb 2, 2020 at 19:32
• Absolutely no! $p|a^p-a$ whatever $a$ is Feb 2, 2020 at 20:32
• So is this right?: Since $6^p(p - 4)! \equiv 1$ (mod $p$), then $6^p(p - 4)! + 10^{3p}\equiv 1001$ (mod $p$), since $1000^p \equiv 1000$. Then I need to find $p$ such that $p| 1001$?
– java
Feb 2, 2020 at 20:42
• Yes. It is correct Feb 2, 2020 at 20:56

HINT.-After you have $$6^p(p-4)!\equiv 1\pmod p$$ you need $$1+(10^p)^3\equiv1+10^3=1001=7\cdot11\cdot13\equiv0$$ then you have three solutions $$7,11$$ and $$13$$.