Solution (source code)

= Solution

For noninteracting <fermions>, each single-particle level has occupation $n_i\in\{0,1\}$ by the <Pauli exclusion principle>. A microstate has $E=\sum_i\epsilon_in_i$, $N=\sum_in_i$, so its grand-canonical weight is the product of its <independent> level weights. The <grand potential> is $\Omega=-kT\log\mathcal Z$; the particle number, <entropy> and <pressure> follow from $N=-\partial_\mu\Omega$, $S=-\partial_T\Omega$ and $P=-\partial_V\Omega$. This occupation description is the basis for the product, continuum and adiabatic calculations.

Summing separately over the two allowed occupations of every level gives
$$
\mathcal Z=\prod_i\sum_{n_i=0}^1e^{-n_i(\epsilon_i-\mu)/(kT)}
=\prod_i\left(1+e^{-(\epsilon_i-\mu)/(kT)}\right).
$$
Thus
$$
\boxed{\log\mathcal Z=\sum_i\log\left(1+e^{-(\epsilon_i-\mu)/(kT)}\right).}
$$
The factorization uses the absence of interactions; each level, including any degeneracy labels, is counted separately.