Number density of photons and the total energy of the universe I was reading over some assignment solutions that my lecturer put up and one of them said that instead of calculating the number of photons in the universe with the familiar method of $$\int^{\infty}_0(\tfrac{k_bT}{h})^3\tfrac{x^2dx}{e^x-1}\times \tfrac{8\pi}{c^3}.$$ That we can can take the mean energy of a photon to be $kT$ and use that as an estimate instead. He didn't go any further into explaining how to do so and I'm not sure I understand how to do what he meant. 
Would it be something like $$n_{o,\gamma}=\tfrac{\text{Total energy density of universe}}{Energy one photon}?$$ If so then how does one calculate the total energy of the universe in this expression?
 A: The photon number per $m^3$ can be calculated from,
$$n_{\gamma}=\frac {\text{Energy density of the photon}} {\text{Energy per photon}}$$
and If we want to calculate the total number of photons in the universe, we can write
$$N=n_{\gamma}\,V_{universe}$$ Where $V_{universe}=4\,10^{80}m^3$
Lets calculate it
We can take the mean energy of the photon as $$E_{mean}=2.70\,kT$$ where $k=1.380\,10^{-23}JK^{-1}$ and $T=2.725K$ (Tempature of the CMB)
From here we get  $$E_{mean}=1.015\,10^{-22}J$$
Energy density of the photons can be calculated from,
$$\epsilon_{\gamma}=aT^4=\frac {4\sigma} {c}T^4$$ where $a= 7.56×10^{-16} Jm^{−3} K^{−4}$
From here we have 
$$\epsilon_{\gamma}=4.171\,10^{-14}Jm^{−3} $$
Hence, $$n_{\gamma}=\frac {\epsilon_{\gamma}} {E_{mean}}\frac {4.171\,10^{-14}Jm^{−3}} {1.015\,10^{-22}J}=4.109\,10^{8}m^{−3}$$
Finally, $$N=4.109\,10^{8}m^{−3}\,4\,10^{80}m^3=1.6436\,10^{89} photon$$
Note: An approximation can be made by using the photon-baryon ratio. 
$$\eta = n_b/n_{\gamma}= 6.1 \times 10^{-10}$$ 
Assuming there are $ n_b \approx 10^{80}$ baryons in the observable universe,  by using above identity we get 
$$n_{\gamma} \approx 10^{90}$$
