Now into its eighth edition and with additional material on primality testing, written by J. H. Davenport, The Higher Arithmetic introduces concepts and theorems in a way that does not require the reader to have an in-depth knowledge of the theory of numbers but also touches upon matters of deep mathematical signiﬁcance. A companion website (www.cambridge.org/davenport) provides more details of the latest advances and sample code for important algorithms. Reviews of earlier editions: ‘. . . the well-known and charming introduction to number theory . . . can be recommended both for independent study and as a reference text for a general mathematical audience.’ European Maths Society Journal ‘Although this book is not written as a textbook but rather as a work for the general reader, it could certainly be used as a textbook for an undergraduate course in number theory and, in the reviewer’s opinion, is far superior for this purpose to any other book in English.’ Bulletin of the American Mathematical Society

THE HIGHER ARITHMETIC

AN INTRODUCTION TO THE THEORY OF NUMBERS

Eighth edition

H. Davenport

M.A., SC.D., F.R.S.

late Rouse Ball Professor of Mathematics in the University of Cambridge and Fellow of Trinity College Editing and additional material by

James H. Davenport

CAMBRIDGE UNIVERSITY PRESS

Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo Cambridge University Press The Edinburgh Building, Cambridge CB2 8RU, UK Published in the United States of America by Cambridge University Press, New York www.cambridge.org Information on this title: www.cambridge.org/9780521722360 © The estate of H. Davenport 2008 This publication is in copyright. Subject to statutory exception and to the provision of relevant collective licensing agreements, no reproduction of any part may take place without the written permission of Cambridge University Press. First published in print format 2008

ISBN-13 ISBN-13

978-0-511-45555-1 978-0-521-72236-0

eBook (EBL) paperback

Cambridge University Press has no responsibility for the persistence or accuracy of urls for external or third-party internet websites referred to in this publication, and does not guarantee that any content on such websites is, or will remain, accurate or appropriate.

CONTENTS

Introduction I Factorization and the Primes

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. The laws of arithmetic Proof by induction Prime numbers The fundamental theorem of arithmetic Consequences of the fundamental theorem Euclid’s algorithm Another proof of the fundamental theorem A property of the H.C.F Factorizing a number The series of primes

page viii 1 1 6 8 9 12 16 18 19 22 25 31 31 33 35 37 40 41 42 45 46

II Congruences

1. 2. 3. 4. 5. 6. 7. 8. 9. The congruence notation Linear congruences Fermat’s theorem Euler’s function φ(m) Wilson’s theorem Algebraic congruences Congruences to a prime modulus Congruences in several unknowns Congruences covering all numbers

v

vi

III Quadratic Residues

1. 2. 3. 4. 5. 6. Primitive roots Indices Quadratic residues Gauss’s lemma The law of reciprocity The distribution of the quadratic residues

Contents

49 49 53 55 58 59 63 68 68 70 72 74 77 78 82 83 86 92 94 99 103 103 104 108 111 114 116 116 117 120 122 124 126 128 131 133

IV Continued Fractions

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Introduction The general continued fraction Euler’s rule The convergents to a continued fraction The equation ax − by = 1 Inﬁnite continued fractions Diophantine approximation Quadratic irrationals Purely periodic continued fractions Lagrange’s theorem Pell’s equation A geometrical interpretation of continued fractions

V

Sums of Squares

1. 2. 3. 4. 5. Numbers representable by two squares Primes of the form 4k + 1 Constructions for x and y Representation by four squares Representation by three squares

VI Quadratic Forms

1. 2. 3. 4. 5. 6. 7. 8. 9. Introduction...