Numbers are part of our everyday experience and their properties have fascinated mankind since ancient times. Deciding whether a number is prime and if not, what its factors are, are both fundamental problems. In recent years analysis and solution of these problems have assumed commercial significance since large primes are an essential feature of secure methods of information transmission. The purely mathematical fascination that led to the development of methods for primality testing has been supplemented by the need to test within reasonable timescales, and computational methods have entered at all levels of number theory. In this book, Peter Giblin describes, in the context of an introduction to the theory of numbers, some of the more elementary methods for factorization and primality testing; that is, methods independent of a knowledge of other areas of mathematics. Indeed everything is developed from scratch so the mathematical prerequisites are minimal. An essential feature of the book is the large number of computer programs (written in Pascal) and a wealth of computational exercises and projects (in addition to more usual theory exercises). The theoretical development includes continued fractions and quadratic residues, directed always towards the two fundamental problems of primality testing and factorization. There is time, all the same, to include a number of topics and projects of a purely 'recreational' nature.