We give an efficient method, combining number-theoretic and combinatorial ideas, to exactly compute black hole entropy in the framework of loop quantum gravity. Along the way we provide a complete characterization of the relevant sector of the spectrum of the area operator, including degeneracies, and explicitly determine the number of solutions to the projection constraint. We use a computer implementation of the proposed algorithm to confirm and extend previous results on the detailed structure of the black hole degeneracy spectrum.We want to thank J. Baez, I. Garay, H. Sahlmann, and J. Salas for their comments. This work is supported by the Spanish MEC Grants No. FIS2005-05736-C03-02, No. FIS2005-05736-C03-03, No. ESP2005-07714-C03-01, a...