Divisibility by 3 Maybe this is a duplicate question (if so, can the moderators be kind enough to merge this appropriately?), but what is the condition on $a$ and $b$ for an expression $am+b$ to be divisible by $3$  ($a$ and $b$  are integers)? For example, I can say $16m+3$ is divisible by $3$ since $b=3$ is divisible by $3$ and for $m$ a multiple of $3$, $3|16m$. In the case of $176m+23$, I don't think it is divisible by $3$. Is this the case?

A basic principle is that if $3|v$, then $3|w \iff 3|v+w$.  Furthermore, if $3|v$ then 
$3|nv$.
So $3|ma+b\iff3|ra+s,$ where $r$ is the remainder when $m$ is divided by $3,$ 
and $s$ is the remainder when $b$ is divided by $3$.
Now we have only $9$ possibilities to consider:
$r=0, 1, $ or $2, $ and $s=0, 1, $ or $2$.
When $r=0$ and $s=0$, $ra+s=0$ is divisible by $3$.
When $r=0$ and $s=1$ or $2$, $ra+s=1$ or $2$ is not divisible by $3$.
When $s=0$ and $r=1$ or $2$, then $ra+s=ra$ is divisible by $3$ when $a$ is and not when $a$ is not.
When $r=1$ and $s=1,$ then $ra+s=a+1,$ so $ra+s$ is divisible by $3$ when $a$ leaves remainder $2$ when divided by $3$. 
When $r=1$ and $s=2,$ then $ra+s=a+2,$ so $ra+s$ is divisible by $3$ when $a$ leaves remainder $1$ when divided by $3$.  
When $r=2$ and $s=1,$ then $ra+s=2a+1,$ so $ra+s$ is divisible by $3$ when $a$ leaves remainder $1$ when divided by $3$.  
When $r=2$ and $s=2,$ then $ra+s=2a+2,$ so $ra+s$ is divisible by $3$ when $a$ leaves remainder $2$ when divided by $3.$
