  We develop a quantitative analytic theory that accurately describes the
odd-even effect observed experimentally in a one-dimensional, trapped Fermi gas
with a small number of particles [G. Z\"urn et al., Phys. Rev. Lett. 111,
175302 (2013)]. We find that the underlying physics is similar to the parity
effect known to exist in ultrasmall mesoscopic superconducting grains and
atomic nuclei. However, in contrast to superconducting nanograins, the density
(Hartree) correction dominates over the superconducting pairing fluctuations
and leads to a much more pronounced odd-even effect in the mesoscopic, trapped
Fermi gas. We calculate the corresponding parity parameter and separation
energy using both perturbation theory and a path integral framework in the
mesoscopic limit, generalized to account for the effects of the trap, pairing
fluctuations, and Hartree corrections. Our results are in an excellent
quantitative agreement with experimental data and exact diagonalization.
Finally, we discuss a few-to-many particle crossover between the perturbative
mesoscopic regime and non-perturbative many-body physics that the system
approaches in the thermodynamic limit.
