[Math] Prove that if $a$ divides $ b$ , and $a$ divides $b + 2$ then $a = 1$ or $ a = 2$.

discrete mathematicsdivisibilityelementary-number-theory

For positive integers $a,b$, prove that if $a$ divides $b$ and $a$ divides $b + 2$ then $a = 1$ or $a = 2$.

I know that if $a|b$ and $a|c$ then $a|b+c$ or $a|b-c$ but I can't figure out how to get $a=1$ or $a=2$.

Best Answer

You "know that if $a|b$ and $a|c$ then $a|b-c$".

So if $a|b+2$ and $a|b$ then $a|(b+2)-b$, i.e. $a|2$.

What divides $2$?