  We obtain analytical expressions for the generating function $\xi_d(\lambda)$
of the sum of $d$-squares arithmetical function $r_d(n)$ where $\lambda$ is a
free parameter. The original $d$-dimensional infinite sum is reduced to a
formula containing a single finite sum over a convergent series. We compare the
formulas to numerical computations and show that the percentage difference is
negligible at small $\lambda$ for various values of $d$. $\xi_d(\lambda)$
divides naturally into two terms and we show that one term has a direct
physical application to the $d$-dimensional Casimir energy of massless scalar
fields in cubic cavities.
