Solution (source code)

= Solution

Using $\varepsilon=\hbar\omega_c(n+1/2)$ gives the charge-explicit result
$$
\boxed{E^2=m^2c^4+p_z^2c^2+|e|\hbar|B|c(2n+1)-e\hbar Bc\,s_z.}
$$
For $B>0$ the two spin signs are equivalently $m^2c^4+2mc^2[p_z^2/(2m)+\mu B(2n+1)\pm\mu B]$. Both positive and negative <relativistic energy> branches arise from this squared equation; an actual <Dirac spinor> must still be reconstructed from the coupled equations, especially at exceptional values where division by $E+mc^2$ is unavailable.