From equations
for the canonical ensemble partition function for an ideal gas, and
for the Helmholtz energy function, one has
using Stirling's approximation
one arrives at