On a theorem of S. Chowla