Find all integers $a$ such that $5 \mid a^{3}+3 a+1$
We test all possible congruences of $a$:

$-a \equiv 0: a^{3}+3 a+1 \equiv 1$

$-a \equiv 1: a^{3}+3 a+1 \equiv 1+3+1 \equiv 0$

$-a \equiv 2: a^{3}+3 a+1 \equiv 8+6+1 \equiv 0$

$-a \equiv 3: a^{3}+3 a+1 \equiv 27+9+1 \equiv 2-1+1 \equiv 2$

$-a \equiv 4: a^{3}+3 a+1 \equiv-1-3+1 \equiv 2$

Therefore, all numbers congruent to 1 and 2 are solutions.