Here we will show how the entropy can be related to the partition function without resorting to Helmholtz free energy $ F $. From the first law

$ dE = T dS $

$ dS = \frac{dE}{T} = \frac{1}{T} \frac{\partial E}{\partial T} dT = \frac{1}{T} \frac{\partial}{\partial T} \left( kT^2 \frac{\partial}{\partial T} \ln Z \right) dT $

In the last transition we used the relation between the partition function and the energy. Integrating the last equation yields

$ S = \int \frac{1}{T} \frac{\partial}{\partial T} \left( kT^2 \frac{\partial}{\partial T} \ln Z \right) dT = $

We use integration by parts to simplify the last integral

$ = \int \frac{\partial}{\partial T} \left( kT \frac{\partial}{\partial T} \ln Z \right) dT - \int \frac{\partial}{\partial T} \left(\frac{1}{T} \right) \left( kT^2 \frac{\partial}{\partial T} \ln Z \right) dT = $

$ = kT \frac{\partial}{\partial T} \ln Z + k \int \left( \frac{\partial}{\partial T} \ln Z \right) dT = kT \frac{\partial}{\partial T} \ln Z + k \ln Z = $

$ = \frac{\partial}{\partial T} \left( kT \ln Z \right) = -\frac{\partial F}{\partial T} $

which reproduces the known result.