  Based on a recent generalization of Bloch's theorem, we present a Bloch
ansatz for the Harper model with an arbitrary rational magnetic flux in various
geometries, and solve the associated ansatz equations analytically. In the case
of a cylinder and a particular boundary condition, we find that the energy
spectrum of edge states has no dependence on the length of the cylinder, which
allows us to construct a quasi-one-dimensional edge theory that is exact and
describes two edges simultaneously. We prove that energies of bulk states,
generating the so-called Hofstadter's butterfly, depend on a single
geometry-dependent spectral parameter and have exactly the same functional form
for the cylinder and the torus with general twisted boundary conditions, and
argue that the (edge) bulk spectrum of a semi-infinite cylinder in an
irrational magnetic field is (the complement of) a Cantor set. Finally,
realizing that the bulk projection of the Harper Hamiltonian is a linear form
over a deformed Weyl algebra, we introduce a Bethe ansatz valid for both
cylinder and torus geometries.
