  The anomaly cancellation equations for the $U(1)$ gauge group can be written
as a cubic equation in $n-1$ integer variables, where $n$ is the number of Weyl
fermions carrying the $U(1)$ charge. We solve this Diophantine cubic equation
by providing a parametrization of the charges in terms of $n-2$ integers, and
prove that this is the most general solution.
