TITLE: The divisor bound for binary quadratic forms
QUESTION [5 upvotes]: The divisor bound asserts that for a large integer $n\in \mathbb{Z}$, the number of divisors of $n$ is at most $n^{o(1)}$ as $n\rightarrow\infty$. See here for a discussion of proofs using elementary analysis.
This  MO topic asked the same question with $\mathbb{Z}$ replaced by the ring of integers in a number field.
My question is whether a similar bound holds in the case of the number of representations by a   binary, positive, integral quadratic form.
More precisely, let $Q(x,y) = a x^2+ b x y + c y^2$ be a binary quadratic form with $a,b,c$ integers and discriminant $\Delta = b^2 - 4 a c <0$.
For any positive integer $n$, let $r_Q(n)$ be the number of integer solutions $(x,y)$ of the equation
$$n = Q(x,y).$$

Question: For $n$ large, is it known that $r_Q(n) = n^{o(1)}$?

Any references would be helpful.
When $\Delta$ is a fundamental discriminant, then one can use the theory of quadratic fields and the divisor bounds therein to deduce the same for our case. When $\Delta$ is a general discriminant, the cases seem tricky (especially when the associated fundamental discriminant $\Delta_0$ is $1 \mod 4 $).
From D.A.Buell, Binary Quadratic Forms, Section 4.4, it seems that the classical theory of quadratic forms doesn't impose any condition on $\Delta$. In fact it seems to proceed along the lines of factoring $n$ into prime factors, getting at most $2$ classes of forms which represent each prime (depending on $\Delta$, of course) and composing them to obtain the classes of forms representing $n$. Then, within each class, it is up to the modular group to generate more solutions (the orbit of $(\pm 1,0)$ under $SL_2\mathbb{Z}$). The cardinality of this orbit seems to be bounded by an absolute constant. 
In this approach, the answer to the question seems to be obtained by an analysis parallel to that of the divisor function. Sounds reasonable?

REPLY [6 votes]: Let $r_Q^*(n)$ be the number of primitive representations of $n$ by $Q$. Let $\mathcal{C}$ be 
a set of representatives of the classes of binary quadratic forms of discriminant $\Delta$. We can assume that $Q\in\mathcal{C}$. It is known that $\sum_{Q'\in\mathcal{C}}r_{Q'}^*(n)$ equals the number of residue classes $b\pmod{2n}$ such that $b^2\equiv\Delta\pmod{4n}$, see e.g. Page 66 in Zagier: Zetafunktionen und quadratische Körper (Springer 1981). By the Chinese Remainder Theorem, we can calculate this as a product of local densities, in fact this is an instance of Siegel's mass formula. Estimating crudely we get
$$ \sum_{Q'\in\mathcal{C}}r_{Q'}^*(n) \ll_\Delta 2^{\omega(n)},$$
where $\omega(n)$ is the number of prime factors of $n$, whence $r_Q^*(n)\ll_{\Delta,\epsilon} n^\epsilon$ readily follows. Finally,
$$ r_Q(n)=\sum_{d^2\mid n}r_Q^*(n/d^2) \ll_{\Delta,\epsilon} n^\epsilon. $$