Recursion formulae of the N-particle partition function, the occupation numbers and its fluctuations are given using the single-particle partition function. Exact results are presented for fermions and bosons in a common one-dimensional harmonic oscillator potential, for the three-dimensional harmonic oscillator approximations are tested. Applications to excited nuclei and Bose–Einstein condensation are discussed.