# Microchip Mathematics Number Theory

date post

27-Sep-2015Category

## Documents

view

23download

3

Embed Size (px)

description

### Transcript of Microchip Mathematics Number Theory

Microchip Mathematics number theory for computer users

Keith Devlin lIathematlcs Department Unlvenlty of Lancaster

SHIV A PUBLISHING LIMITED 64 Welsh Row, Nantwich, Cheshire CW5 5ES, England

Keith Devlin, 1984

ISBN 1 850140472

All rights reserved. No part of this publication may be reproduced. stored in a retrieval system, or transmitted in any form or by any means. electronic, mechanical, photocopying. recording and/or otherwise, without the prior written permission of the Publishers.

This book is sold subject to the Standard Conditions of Sale of Net Books and may not be resold in the UK below the net price given by the Publishers in their current price list.

The front cover shows the author with a print-out of the largest known prime number, a number with 39751 digits. The print-out is 9 feet in length. It required over half an hour of main frame computer time to work out the digits in this number. (Photograph taken at The Computer Unit, Warwick University, courtesy of Dr Keith Halstead.)

Printed and bound in Great Britain by Billing and Sons Limited

Contenls

O.

I.

PREFACE

BACKGROUND: PRIME NUMBERS

1.

2.

3.

4.

5.

Prime Numbers

The Sieve of Eratosthenes

The Distribution of Primes

Largest Known Primes

Conjectures About Primes

Exercises 0

Computer Problems 0

BASIC CONCEPTS

1.

2.

3.

4.

5.

Mathematical Induction

Divisibility. The Euclidean Algorithm

Efficiency of Algorithms. Mu1tiprecision

Arithmetic

The Fibonnaci Sequence and the Efficiency

of the Euclidean Algorithm

Prime Numbers

v

1

2

4

5

8

9

11

12

14

14

23

34

43

48

iii

II.

III.

iv

6. Diophantine Equations

Exercises I

Computer Problems I

CONGRUENCES

1.

2.

3.

4.

Congruence

Modular Arithmetic

Fermat's Little Theorem and the

Euler Phi-Function

Random Number Generators and Primitive Roots

Exercises II

Computer Problems II

PRIMALITY TESTING AND FACTORISATION

1.

2.

3.

4.

Perfect Numbers and Mersenne Primes

Public Key Cryptography

Primality Testing

Factorisation Techniques

Exercises III

Computer Problems III

RECOMMENDED FURTHER READING

INDEX OF NUTl\1'fON

INDEX

51

55

59

62

62

77

94

107

128

135

138

139

153

163

178

191

197

202

203

204

Preface

In the Autumn of 1983, in the face of the phenomenal growth of

home computer sales in the U.K., the national British newspaper

The Guardian decided to produce, each week, a 'Computer Page'.

Noone was quite sure exactly what should go into the page on a

regular basis, but it was thought that a fortnightly column on

computer mathematics might be a good idea, and when the computer

page first appeared on 20th October of that year, it included a

small item on binary arithmetic by me.

From the mail I received after my column had been running

for a few months, it was clear that the microcomputer age had brought

with it a huge increase in the number of (potential)

'recreational mathematicians'. Though in many cases without any

formal training in mathematics, my correspondents displayed tremendous

mathematical ability, and I was frequently asked if I could recommend

any suitable books. What they seemed to want was a genuine

mathematics text book, but one which did not require a great deal

of prior knowledge. This is intended to be just such a book.

Number Theory is one of the few areas of modern mathematics

which is accessible to the non-expert. (At least, the kind of

Number Theory considered here: there is a lot of other material

v

which also goes under the title 'Number Theory', most of which

is pretty well inaccessible to the majority of trained

mathematicians~) It is also an area in which there is a genuine

two-way flow between man and the computer. Indeed, it was this

fascinating interplay of brain power and computer power that

awakened my own interest in the subject to a level where I began

to give a course on the subject at Lancaster University and,

coincidentally, write about it in The Guardian. (Previously my

mathematical research work had been in Set Theory, a subject dealing

almost exclusively with the mysterious world of the infinite.)

This is a book about (the computational aspects of) Number

Theory. Though written for university undergraduates in

mathematics, I have tried to present the material in such a way

that it can be followed by the keen but largely untrained 'amateur'

sitting at home with (or possibly even without) a cheap home

computer. I do not pretend to give a complete coverage of the

computational aspects of Number Theory. (For instance, no mention

is made of Quadratic Reciprocity, a tremendously important part

of the subject.) Rather my aim is to cover the (very) basic parts

of Number Theory and at the same time give some indication of the

way in which Number Theory both feeds off and leads to advances

in Computation Theory. Consequently, if the book were used as

a text to accompany a university lecture course, the lecturer would

presumably deal with additional topics not covered in this book.

In writing this book, I made extensive reference to, in

particular, two excellent books, to which this text could be regarded

as a precursor. David Burton's book Elementary Number Theory

gives a wonderfully readable coverage of (essentially the non-

vi

computational aspects of) Number Theory, and covers many more topics

than I have space for here, whilst Donald Knuth's 'The Art of

Computer Programming, Volume ~' is the 'bible' for serious

computational number theorists.

The book is structured in a way that assumes a more or less

direct passage from start to finish, though an index is provided

to enable the book to be used as a reference text if necessary.

Each chapter (including an informal preparatory chapter) ends with

a selection of (mathematical) Exercises, grouped according to the

section they refer to, and some Computer Problems. The latter

are, for the most part, just initial 'pointers' as to what can be

tried out on a computer, and I would hope that these are enough

to spur the reader on to carrying out further computer investigations

of his or her own devising.

To assist readers who wish to skip proofs and concentrate on

the development of the main results, the symbol 0 is used to

indicate the end of a proof. (Whenever this symbol occurs

immediately following the statement of a result, this indicates

that the proof is so obvious as to require no further comment.)

For easy reference, all results obtained are numbered consecutively,

the reference numbers consisting of the Chapter number, section

number, and result number.

Keith Devlin

Lancaster, August 1984

vii

Pierre De Fermat: 'The Father of Number Theory'. Born in 1601

near Toulouse in France, Fermat was a jurist by profession, and

only took up mathematics as a hobby in his thirties. Through

correspondence with many of the leading scholars of the day, Fermat

developed most of the pivotal ideas of present day Number Theory.

Many of his ideas to simplify mental calculation are nowadays

employed to speed up computer algorithms. This painting is from

the collection of the Academie des Sciences, Inscriptions et

Belles Lettres de Toulouse; it is reproduced here with the kind

permission of Robert Gillis.

o Background: Prime Numbers

Numbers constitute the one mathematical system familiar to all

mankind, at least if by 'number' you mean 'positive whole number'

as did the Ancient Greeks. Today the professional mathematician

uses the phrase 'natural number' to denote the positive whole

numbers 1,2,3, .. This is a book about these 'natural' numbers,

and we shall rarely have occasion to speak of other numbers such

as proper fractions like t,t, or t. The study of the natural

numbers is known as 'Number Theory', and in keeping with the

traditions of that subject we shall use the word 'number' to mean

'natural number' unless otherwise indicated. (This convention

is used in the very name 'Number Theory' of course.)

The natural numbers are so fundamental to the rest of

mathematics that the famous 19th Century mathematician Leopold

Kronecker once remarked that 'God created the natural numbers,

and all the rest is the work of man.' What he meant by this

was that, starting from the natural numbers it is possible to

construct, in a rigorous fashion, the entire edifice of modern

mathematics, which is true, and that the natural numbers themselves

cannot be constructed (in a mathematical sense) from any simpler

entities, which was true when Kronecker made his remark but is

1

no longer valid, Cantor's Set Theory having p

*View more*