I wonder why every proof of these laws consider the number of of oscillator in the end but disregard it while deriving the mean energy. Let me explain. Considering an oscillator in a heat bath, there are six variables in phase space, $x$, $y$, $z$, $p_x$, $p_y$ and $p_z$. Integrating the probability density over a 6-D ellipse we have that the probability of finding the oscillator with energy $$E<\frac{p_x^2}{2 m}+\frac{p_y^2}{2 m}+\frac{p_z^2}{2 m}+\frac{k x^2}{2}+\frac{k y^2}{2}+\frac{k x^2}{2}.$$ The partition function is $$z=\int \exp\left[-\beta \left(\frac{p_i^2}{2m}+\frac{k x_i^2}{2}\right)\right]dx_i^3 dp_i^3 = \left(\sqrt{\frac{2m \pi}{\beta}}\sqrt{\frac{2 \pi}{\beta k}}\right)^3 .$$ The probability is $$P(E<E_0) = \frac{1}{z} \int_{E<E_0} e^{-\beta E_0} dx_i^3 dp_i^3.$$ Setting $r_1 = \sqrt{\frac{k}{2}}x$, $r_2=\sqrt{\frac{k}{2}}y$, $r_3=\sqrt{\frac{k}{2}}z$, $r_4 =\frac{p_x}{\sqrt{2 m}}$,$r_5 =\frac{p_y}{\sqrt{2 m}}$ ,$r_6 =\frac{p_z}{\sqrt{2 m}}$, and $ r = \sqrt{r_1^2+r_2^2+r_3^2+r_4^2+r_5^2+r_6^2}$ we have \begin{align} P(E<E_0) & = \frac{1}{z} \int_{r^2<E_0} e^{-\beta r^2} (\sqrt{2 m}\sqrt{\frac{2 }{ k}})^3dr_i^6 \\ &= \frac{\beta^3}{\pi^3} \int_{r^2<E_0} e^{-\beta r^2} dr_i^6\\ &= \beta^3 \int_0^{\sqrt E_0} e^{-\beta \rho^2} \rho^5 d\rho \end{align}
Making the substitution $E = \rho^2 $:
$$P(E<E_0)= \beta^3 \int_0^{E_0} \frac{1}{2} E^2 e^{-\beta E } dE$$
In all proofs I've read the factor $E^2$ simply disappears, but it precisely counts the number of oscillators with a given energy. If calculate the expected value, we have $$\beta^3 \int_0^{\infty} \frac{1}{2} E^3 e^{-\beta E } dE = \frac{3}{\beta}.$$ That's there times the temperature, for $\beta = \frac{1}{k_B T}$, because of the three dimensions. If someone could explain me why my reasoning is wrong I'll be very grateful.