An Introduction to the theory of numbers - Niven, Ivan. (New York Wiley, 1972)