  Let $f$ be a positive definite integral quadratic form in $d$ variables. In
the present paper, we establish a direct link between the genus representation
number of $f$ and the order of higher even $K$-groups of the ring of integers
of real quadratic fields, provided $f$ is diagonal and $d \equiv 1 \mod 4$, by
applying the Siegel mass formula. When $d=3$, we derive an explicit formula of
$r_f(n)$ in terms of the class number of the corresponding imaginary quadratic
field and the central algebraic values of $L$-functions of quadratic twists of
elliptic curves, by exploring a theorem of Waldspurger. Moreover, by the
$2$-divisibility results on the algebraic $L$-values of quadratic twist of
elliptic curves, we obtain a lower bound for the $2$-adic valuation of $r_f(n)$
for some odd integer $n$. The numerical results show our lower bound is optimal
for certain cases. We also apply our main result to the quadratic form
$f=x_1^2+\cdots+x^2_d$ to determine the order of the higher $K$-groups
numerically.
