# Finding all numbers of the form $a2005b$ and divisible by $13$

If $a,b$ are integers such that $0 \le a$ ,$b\le 9$ and $a\neq0$ .How to find the all numbers from the six digits of the form $a2005b$ and divisible by $13$

-
What mean of the $a2005b$? $a^{2005}b$? or $a+2005b$? –  tetori Feb 13 '13 at 13:13
@tetori For example : $120055$ –  user62151 Feb 13 '13 at 13:19

A number of the form $a2005b$ is $100000a+20050+b.$ $20050 \equiv 4 \pmod {13}$ and $100000 \equiv 4 \pmod {13}$. So we are solving $4a+b+4 \equiv 0 \pmod {13}$. For each $a \in [0,12]$ there will be a $b \in [0,12]$ You just need to check the constraints that $a \in [1,9], b \in [0,9]$. You can start from $a=12, b=0$ and each time you decrease $a$ by $1$, you increase $b$ by $4$.