# All possible values of $k$ such that $a\le k \le b$ and $k$ is a linear combination of a and b [duplicate]

I am looking for a general rule for all possible integers $k\in(a,b)$ such that $k$ is can be expressed as a linear combination of $a$ and $b$.

I understand that k must be a multiple of $\gcd(a,b)$, since any linear combination of $a$ and $b$ will be a multiple of $\gcd(a,b)$. Is there a general formula for $k$ in terms of $a,b$?

Thanks in advance!

• The reverse is also true : all the multiples of $(a,b)$ are expressible as such a linear combination . This follows from Bézout's theorem .
– user252450
Commented Dec 21, 2015 at 19:26
• Could you elaborate what multiples of (a,b) mean? or did you mean gcd(a,b)? Because that's the answer I came up with too, as written in my answer below! Commented Dec 21, 2015 at 19:29
• Yes , this is what I mean . Both notations are commonly used .It depends which you prefer .
– user252450
Commented Dec 21, 2015 at 19:31
• Thanks for your reply! Now know the formal reasoning for what I was thinking! Commented Dec 21, 2015 at 19:33

## 1 Answer

With a little bit of thinking, I was able to answer it myself. It is actually quite obvious.

Since we know that k must be a multiple of gcd(a,b), and that a and b both are multiples of gcd(a,b)-

let gcd(a,b) be g. so, k includes all integers - a,a+g,a+2g,a+3g......,b-g,b.

And these are all the possible values of k!