  The resolution of the Schr\"odinger equation for the translation-invariant
$N$-body harmonic oscillator Hamiltonian in $D$ dimensions with one-body and
two-body interactions is performed by diagonalizing a matrix $\mathbb{J}$ of
order $N-1$. It has been previously established that the diagonalization can be
analytically performed in specific situations, such as for $N \le 5$ or for $N$
identical particles. We show that the matrix $\mathbb{J}$ is diagonal, and thus
the problem can be analytically solved, for any number of arbitrary masses
provided some specific relations exist between the coupling constants and the
masses. We present analytical expressions for the energies under those
constraints.
