





























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






























Definition: A positive integer n is prime iff its only divisors are 1 and n.
Examples: 7 is a prime. 111 is not a prime.
Is 225593397919 a prime?
Is 2^229-91 a prime? (2^229-91 = 862718293348820473429344482784628181556388621521298319395315527974821 )
n is a prime iff its only divisors are 1 and n
(define (divides? a b) (= (remainder b a) 0)) (define (smallest-divisor n) (define (find-divisor n i) (cond ((> i (sqrt n)) n) ((divides? i n) i) (else (find-divisor n (+ i 1))))) (find-divisor n 2))
If n is a 800 digit number, that’s is also very bad. Absolutely infeasible.
2013/4/23 10
Fermat’s theorem: Every prime will always pass the test. Definition: A Carmichael number, is a number such that
Error probability smaller than the chance the hardware is faulty.
Suppose we do the test t=100 times.
function Fermat (n) a := random integer between 1 and n- if (expomod (a,n-1,n) = 1 then return true // n might be prime else return false // n is not prime