The density of states of electrons on the surface of a semiconductor cylindrical nanotube and the grand thermodynamic potential in a longitudinal magnetic field are obtained in terms of the Jacobi elliptic theta function. At low temperatures, the diamagnetic moment of the electron gas on the tube in a weak magnetic field is calculated.