{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cse101_10_3_11

# cse101_10_3_11 - Primality vs factoring 1 Primality testing...

This preview shows pages 1–2. Sign up to view the full content.

Primality vs factoring 1. Primality testing a. Given a number N, determine whether it is prime. b. Fermat’s little theorem: if p is prime, then a p-1 (mod p) for all 1 <=a < p. P = 7 is prime. So Fermat’s thm: 1 6 === 1 (mod 7) 2 6 === 1 3 6 === 1 Etc. c. Idea for a Primality tester: Given a number N. pick some a -> is a n-1 === 1 (mod N)? if yes, output = prime. if no, output composite. Problem: if N is prime, it will pass Fermat’s test. But even a composite N might pass the test. Eg. N = 341 = 11*13 composite. 2 340 = (2 10 ) 34 mod 341 = 1. d. It turns that there are just three possibilities for N: d.i. N is prime and a N-1 === 1 (mod N) for all 1 <= a <N. d.ii. N is composite and a N-1 (mod N) for all 1 <= a < N. Such N are called cormichael numbers – exceeding rare and can be detected separately. So we’ll just ignore them. d.iii. N is composite and at least half the possible values of 1 <= a < N will have a N-1 !=== (mod N) but whether it passes Fermat’s test e. Randomized algorithm Given N: Pick 1 <= a < M at random If a N-1 !=== (mod N): output composite Else output PRIME.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

cse101_10_3_11 - Primality vs factoring 1 Primality testing...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online