Degeneracy of the isotropic harmonic oscillator

The formula can be written as $$g= \binom{n+p-1}{p-1}$$ it corresponds to the number of weak compositions of the integer $n$ into $p$ integers. It is typically derived using the method of stars and bars:

You want to find the number of ways to write $n= n_1 + \cdots + n_p$ with $n_j \in \mathbb{N}_0.$ In order to find this, you imagine to have $n$ stars ($\star$) and $p-1$ bars ($|$). Each composition then corresponds to a way of placing the $p-1$ bars between the $n$ stars. The number $n_j$ corresponds then to the number of stars in the $j$-th `compartement' (separated by the bars).

For example ($p=3, n=6)$:

$$ \star \star | \star \star \star | \star \quad \Rightarrow \quad n_1=2,n_2=3, n_3=1$$ $$ \star| \star \star \star \star \star| \quad \Rightarrow \quad n_1=1,n_2=5, n_3=0.$$

Now it is well known that choosing the position of $p-1$ bars among the $n+(p-1)$ objects (stars and bars) corresponds to the binomial coefficient given above.

In general, the basis states of a $p$-dimensional harmonic oscillator containing a total $$ n_1+n_2+\ldots n_p=N $$ bosons of a single type is simply $\vert n_1n_2\ldots n_p\rangle$.

Since the number-preserving operators $\{C_{ij}=a_i^\dagger a_j; i,j=1,\ldots,p\}$ span the Lie algebra $u(p)$, all states with $n_1+n_2+\ldots n_p=N$ are in the same $u(n)$ irrep, and the dimension is precisely the numbers of ways you can break up $N$ in $p$ non-negative pieces. These irreps are denoted by $(N,0,0,...0_{p-2})$ in the standard mathematical literature. @Fabian provided a closed form expression for the dimension of type of irrep in his answer.

An interesting situation occurs if you allow for more than one type of bosons. For instance, one can use two types of bosons and construct (as done in this paper), $su(3)$ irreps of the type $(\lambda,\mu)$, with the second index non-zero, with $N=\lambda+2\mu$ total excitations. The dimensionality of $(\lambda,\mu)=\frac{1}{2!}(\lambda+1)(\mu+1)(\lambda+\mu+2)$.

In $su(4)$, general irreps are of the type $(\lambda,\mu,\sigma)$ and the dimension of such an irrep - which requires three types of bosons to construct - is $$ \hbox{dim}(\lambda,\mu,\sigma)=\frac{1}{12}(1 + \lambda) (1 + \mu) (1 + \sigma) (2 + \lambda + \mu) (2 + \mu + \sigma) (3 + \lambda + \sigma + \mu)$$.
Of course this collapses to the expected $(p+3)(p+2)(p+1)/6$ when $\mu=\sigma=0$.

A good place to look up this sort of stuff is the review paper by Richard Slansky, Group Theory for unified model building, where all kinds of dimensionalities are given.

The degeracy is also given by the coefficient of $x^n$ in the partition function $1/(1-x)^p$. This, in turn, is the expression given above by the binomial theorem for $(1-x)^{-p}$.