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$?

marked as duplicate by davidlowryduda♦Oct 20 '17 at 13:01

• 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 Dec 21 '15 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! – spandan madan Dec 21 '15 at 19:29
• Yes , this is what I mean . Both notations are commonly used .It depends which you prefer . – user252450 Dec 21 '15 at 19:31
• Thanks for your reply! Now know the formal reasoning for what I was thinking! – spandan madan Dec 21 '15 at 19:33