Find $\,n\bmod 42\,$ given $\,7\mid 3^n+4n+1$ I have been working on a problem relating to remainders: "The number $3^n+4n+1$ is divisible by $7$. Find the remainder of n when it is divided by $42$." I have been unable to find a strategic way to solve this problem and so far, I have only found the remainders, $4$, $8$, $13$, $21$, $23$, and $24$. Can anyone confirm whether this is correct?

Let's say that $n=42a+b$, with $a \in Z$ and $b \in \{0,1,2,3,...,41\}$, since $n\in Z$. 
Substituing we get $ 3^n+4n+1=0 (mod 7) \Rightarrow 3^{42a+b}+4(42a+b)+1=0 (mod 7)$
$ \Rightarrow 3^b.(3^{42})^a+7.(24a)+4b+1=0 (mod 7) \Rightarrow 3^b.(3^{42})^a+4b+1=0 (mod 7)$
Note that $3^{42}=({3^2})^{21}=9^{21}=(7+2)^{21}=2^{21}=64=1 (mod 7)$. 
So $3^b.(1)^a+4b+1=0 (mod 7) \Rightarrow 3^b+(7-3)b+1=0 (mod 7) \Rightarrow 3^b-3b+1=0 (mod 7)$
Now we only have to test all values of $b \in \{0,1,2,3,...,41\}$ which $ 3^b-3b+1$ is multiple of 7, remaining 4, 8, 13, 21, 23 and 24.
