# When does $c\mid a(n+x)+b+1$, if we know that $c\mid an+b$?

If $an+b$ is divisible by $c$. Then for which values of $x$ will $a(n+x)+b+1$ be divisible by $c$?
$a$, $b$, $c$, $n$, $x$ are all non-negative integers.

• Please, try to make the titles of your questions more informative. E.g., Why does $a<b$ imply $a+c<b+c$? is much more useful for other users than A question about inequality. From How can I ask a good question?: Make your title as descriptive as possible. In many cases one can actually phrase the title as the question, at least in such a way so as to be comprehensible to an expert reader. You can find more tips for choosing a good title here. Commented Jun 9, 2015 at 8:23
• What can you say about the difference of $a(n+x)+b+1$ and $an+b$? Commented Jun 9, 2015 at 8:24

As suggested in the comments, if $c\mid an+b$, then $$c\mid a(n+x)+b+1$$$$\iff c\mid a(n+x)+b+1-an-b=ax+1$$

$$\iff ax\equiv -1\pmod{\! c}$$

If $(a,c)=d>1$, then $d\mid -1$, impossible.

So necessarily $(a,c)=1$. It turns out it is sufficient for $x$ to exist.

$a^{-1}$ exists mod $c$, so $ax\equiv -1\iff x\equiv -a^{-1}\pmod{\! c}$.

Expressed without modular arithmetic, we have $$c\mid ax+1\iff a(-x)+ck=1$$

for some integer $k\in\Bbb Z$.

Such integer pair $(-x,k)$ exists iff $(a,c)=1$ by Bezout's lemma.

• Cannot understand the last line. Commented Jun 9, 2015 at 9:03
• @ShubhamAvasthi Edited. Commented Jun 9, 2015 at 9:10
• What do you mean by (a,c) ? Commented Jun 12, 2015 at 8:10
• @ShubhamAvasthi $\gcd(a,c)$. That is a very usual notation for gcd. Commented Jun 12, 2015 at 12:26