A Prime Primer

Post on 17-Mar-2016

220 views 0 download

description

A talk (in progress) on primes and primality tests

Transcript of A Prime Primer

Prime Time

December 2008

Morten Jagd Christensen

Thrane & Thrane A/S

is

25288891392479400456592804986000222944998316082937128866378556017873124536111976520731519116376124029996303932610315220549847432414563643

prime?

313-05-2009Skriv titel på præsentation

Agenda

Number theoryProof of infinite number of primesDistribution of primesFermat s little theorem

Algorithms for primality testing

Testing small primes

Using your graphics card for fast calculationsOpenGL graphics accelerationOpenGL Shading Language programmable graphics pipeline

Testing large primesFast multiplications

GNU Multi Precision library

413-05-2009Skriv titel på præsentation

What is a prime number?

A number which is only divisible by it self and 12 is the only even prime numberOdd prime numbers end in 1, 3, 7 or 9

All natural numbers are uniquely described by prime factors

4=22 6=2 2 8=23 ... 2100 = 22 3 52 7 etc.can be found by factoring into primes

Consider the positive integers 1,2,3,4,.....Primes behave like statistical fluctuations taking up as muchroom as possible considering the requirement of a completesequence of integers

513-05-2009Skriv titel på præsentation

How many primes are there?

Euclid (300 BC) proved there are infinitely many primes

Construct the following new number

m= (2 3 5 7 11 13 17... n) + 1

Neither of 2..n divides m

-> There must be at least one prime larger than n thatdivides m

613-05-2009Skriv titel på præsentation

Mother of prime algorithms

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

713-05-2009Skriv titel på præsentation

Mother of prime algorithms

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2223 24 25 26

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

813-05-2009Skriv titel på præsentation

Mother of prime algorithms

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2223 24 25 26

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

913-05-2009Skriv titel på præsentation

Mother of prime algorithms

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2223 24 25 26

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

1013-05-2009Skriv titel på præsentation

Mother of prime algorithms

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2223 24 25 26

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

1113-05-2009Skriv titel på præsentation

Fermat s little theorem

Composite testif a < p

)1( p

1213-05-2009Skriv titel på præsentation

Fermat s little theorem

Composite testif a < p

so (p,a) = (503, 2)2^502 = 1 (mod 503) could be prime

and (p,a) = (501,2)2^501 = 4 (mod 500) is composite

)1( p

By the way25288891392479400456592804986000222944998316082937128866378556017873124536111976520731519116376124029996303932610315220549847432414563643

is prime

1413-05-2009Skriv titel på præsentation

References

D.E. Knuth The art of Computer Programming

Numerical Recipes in C++

GMP Manual

OpenGL Orange Book

This document was created with Win2PDF available at http://www.daneprairie.com.The unregistered version of Win2PDF is for evaluation or non-commercial use only.