Primitive binary quadratic forms. There's a problem in Niven-Zuckermann-Montgomery which asks us to show that if $f$ is a primitive binary quadratic form and $k$ is a nonzero integer, then there exists an integer $n$ properly represented by $f$ with the property that $(n,k)=1$.
I'm stuck with this problem for quite some time now. 
Help would be greatly appreciated.
Thanks.
 A: Let $f(x,y)=ax^2+bxy+cy^2$ be a primitive quadratic form.

First, an easy result . . .

Lemma:$\;$If $p$ is prime, at least one of $f(1,0),\,f(0,1),\,f(1,1)$ is nonzero, mod $p$.

Suppose otherwise.$\;$Then 


*

*$p{\mid}f(1,0)$ implies $p{\mid}a$.$\\[4pt]$

*$p{\mid}f(0,1)$ implies $p{\mid}c$.$\\[4pt]$

*$p{\mid}f(1,1)$ implies $p{\mid}(a+b+c)$, hence $p{\mid}b$.


But then $p$ is a common factor of $a,b,c$, contrary to $\gcd(a,b,c)=1$.

Thus, the lemma is proved.

Returning to the problem at hand . . .

First, suppose $|k|=1$.

Then letting $n=f(1,1)$, we have $\gcd(n,k)=1$, and $n$ is properly represented by $f$.

Next, suppose $|k| > 1$.

Let $S$ be the set of prime factors of $k$.

By the lemma, for each $p\in S$, we can choose integers $x_p,y_p$ such that $f(x_p,y_p)\not\equiv 0\;(\text{mod}\;p)$.

By the Chinese Remainder Theorem, there exist integers $u,v$ such that the congruences 
$$
\begin{cases}
u\equiv x_p\;(\text{mod}\;p)\\[4pt]
v\equiv y_p\;(\text{mod}\;p)\\
\end{cases}
$$
hold for all $p\in S$.

Then for all $p\in S$, we have
$$f(u,v)\equiv f(x_p,y_p)\;(\text{mod}\;p)$$

hence, $\gcd(f(u,v),k)=1$.

Noting that $u,v$ cannot both be zero, let $d=\gcd(u,v)$.

Making use of Peter's observation (in the main comments), let $u'={\large{\frac{u}{d}}}$, and $v'={\large{\frac{v}{d}}}$.

Then we have $\gcd(u',v')=1$, and $\gcd(f(u',v'),k)=1$.

Hence $n=f(u',v')$ is properly represented by $f$, and $\gcd(n,k)=1$.
