  Let $n$ be a squarefree positive odd integer. We will show that there exist
infinitely many imaginary quadratic number fields with discriminant divisible
by $n$ and-at the same time-having an element of order $n$ in the class group.
We then apply our result to prove that for a given squarefree positive odd
integer $n$ there exist infinitely many $N$ such that $n$ divides both $N$ and
$r(N)$, where $r(N)$ is the representation number of $N$ as sums of three
squares.
