Lifshitz scaling, microstate counting from number theory and black hole entropy