# Numbers of the form $pa+qb = n$

Is it true that numbers of the form $pa+qb = n$ where $\gcd(a,b) = 1$ and $a,b$ are positive integers and $p,q$ are nonnegative integers are unique? That is, they have unique representations $pa+qb$.

I was wondering about this question and wasn't sure. We have that $p_1a+q_1b = p_2a+q_2b$ implying that $a(p_1-p_2) = b(q_2-q_1)$ and thus $k_1b = p_1-p_2$ and $k_2a = q_2-q_1$. We arrive at $k_1 = k_2$.

• No, you can add any solution to $p'a+q'b=0$ so for instance any solution of the form $(p',q')=(-kb,ka)$ for some integer $k$. – String May 21 '16 at 17:00
• To add to @String: any multiple of $ab$ that's added to $n$ can be added as either $(b,0)$ or $(0,a)$, yielding different results. – HSN May 21 '16 at 17:02
• Phrasing it more like you did, you can solve $(\underbrace{p_1-p_2}_{p'})a+(\underbrace{q_1-q_2}_{q'})b=0$ – String May 21 '16 at 17:02

It's not true. Take $a=b=1$ and $n=5$. Then $5=1\cdot1 + 4\cdot1=2\cdot1 + 3\cdot1$
It's not true even if $\gcd(p,q) = 1$, as you can see.
It's false in this generality. For example, if $(a,b)=(2,3)$, you can take a number $n=2p+3q$ where $p$ is big, and change it a little to obtain new representations $$n = 2(p-3) + 3(q+2) = 2(p-6) + 3(q+4) = ...$$ What's true, as you've shown, is that the representation $(p,q)$ is unique when $p$ is taken modulo $b$ and $q$ modulo $a$.
• To have this work, shouldn't you show that $p-3 \geq 0$ as well, since OP asks for nonnegative integers? – HSN May 21 '16 at 17:05
• yeah, and to cover that sloppiness I said "in general you can...", since for most representations $n = 2p + 3q$ for big enough $n$ you'll be able to do what I described :) – amakelov May 21 '16 at 17:07