remainder of $a^2+3a+4$ divided by 7 
If the remainder of $a$ is divided by $7$ is $6$, find the remainder when $a^2+3a+4$ is divided by 7
(A)$2$ (B)$3$ (C)$4$ (D)$5$ (E)$6$

if $a = 6$, then $6^2 + 3(6) + 4 = 58$, and $a^2+3a+4 \equiv 2 \pmod 7$
if $a = 13$, then $13^2 + 3(13) + 4 = 212$, and $a^2+3a+4 \equiv 2 \pmod 7$
thus, we can say that any number, $a$ that divided by 7 has remainder of 6, the remainder of $a^2 + 3a + 4$ is 2.
is there any other way to calculate it? (Let say it given b as the remainder of a divided by 7, not 6)

If the remainder when $a$ divided by $7$ is $b$, then $a = 7n+b$ for some integer $n$. 
Hence, $a^2+3a+4 = (7n+b)^2+3(7n+b)+4$ $= 49n^2 + 14nb + b^2 + 21n + 3b + 4$ $= 7(7n^2+2nb+3n) + (b^2+3b+4)$. 
So, the remainder when $a^2+3a+4$ is divided by $7$ will be the same as the remainder when $b^2+3b+4$ is divided by $7$.   
For the specific case when $b = 6$, we get that $a^2+3a+4 = 7(7n^2+12n+3n)+58$ $= 7(7n^2+12n+3n+8)+2$.
  So the remainder when $a^2+3a+4$ is divided by $7$ is $2$.
