810 likes | 1.03k Vues
Fingerprint. Verifying set equality. String Matching – Rabin-Karp Algorithm. Verifying set equality. Verifying set equality. Verifying set equality. Verifying set equality. Fingerprinting. Fingerprinting. Fingerprinting Computation.
E N D
Verifying set equality • String Matching – Rabin-Karp Algorithm
Fingerprinting Computation Horner’s Rule
Density of Primes • (x) = número de primos menores ou iguais a x • (13) = 6 • Primos < = do que 13 = 2, 3, 5 , 7, 11 e 13 • O valor de não muda até chegarmos ao próximo primo. • (13) = (14) = (15) = (16) • Ou seja, aumenta em salto de 1, mas o intervalo entre esses saltos é irregular
Density of Primes Esses intervalos tornam-se cada vez maiores, isto é, a chance de um inteiro escolhido ao acaso ser primo diminui quando avançamos para os números maiores. PERGUNTA: O valor de não poderia ser aproximado por alguma função conhecida?
Density of Primes Para um valor elevado de x, p(x) ~ x/ ln x . Ou seja, lim (x) = 1 x x/ln x
String Matching • Many applications • While using editor/word processor/browser • Login name & password checking • Virus detection • Header analysis in data communications • DNA sequence analysis
Fingerprinting computation The only expensive operation
Primality testing • A natural number n is prime iff the only natural numbers dividing n are 1 and n
Primality testing • A natural number n is prime iff the only natural numbers dividing n are 1 and n • The following are prime: 2, 3, 5, 7, 11, 13,
Primality testing • A natural number n is prime iff the only natural numbers dividing n are 1 and n • The following are prime: 2, 3, 5, 7, 11, 13, …and so are 1299709,15485863, 22801763489, …
Primality testing • A natural number n is prime iff the only natural numbers dividing n are 1 and n • The following are prime: 2, 3, 5, 7, 11, 13, …and so are 1299709,15485863, 22801763489, … There is an infinite number of prime numbers
Primality testing There is an infinite number of prime numbers Proof:Let us suppose the number of primes is Finite.
Primality testing There is an infinite number of prime numbers Proof:Let us suppose the number of primes is Finite. Let p1, p2, … pk beall primes. Let n = p1p2 … pk+1,
Primality testing There is an infinite number of prime numbers Proof:Let us suppose the number of primes is Finite. Let p1, p2, … pk beall primes. Let n = p1p2 … pk+1, n must becomposite.
Primality testing There is an infinite number of prime numbers Proof:Let us suppose the number of primes is Finite. Let p1, p2, … pk beall primes. Let n = p1p2 … pk+1, n must becomposite. there exists a prime p s.t. p | n (fundtheo. arithmetic), and p cannot be any of the p1,p2, … pk
Primality testing There is an infinite number of prime numbers Proof:Let us suppose the number of primes is Finite. Let p1, p2, … pk beall primes. Let n = p1p2 … pk+1, n must becomposite. there exists a prime p s.t. p | n (fundtheo. arithmetic), and p cannot be any of the p1,p2, … pk Therefore, p1, … pk were not all the prime numbers.
Some questions? • Is 2101-1=2535301200456458802993406410751 prime? • How do we check whether a number is prime? • How do we generate huge prime numbers? • Why do we care?
Some questions? • Is 2101-1=2535301200456458802993406410751 prime? • How do we check whether a number is prime? • How do we generate huge prime numbers? • Why do we care?
Some questions? • Is 2101-1=2535301200456458802993406410751 prime? • How do we check whether a number is prime? • How do we generate huge primenumbers? • Why do we care?
Some questions? • Is 2101-1=2535301200456458802993406410751 prime? • How do we check whether a number is prime? • How do we generate huge primenumbers? • Why do we care?
Naïve solution: Finding the smallest divisor of n • For i=2,..., n do • Divide n by i until n mod i = 0 Check if i is a divisor of n for some i = 2, ..., n
An improvement • Check if i is a divisor of n for some i = 2, ..., n
An improvement • Check if i is a divisor of n for some i = 2, ..., n Why can we do that?
Theorem: Composit numbers have a divisor bellow their square root
Theorem: Composit numbers have a divisor bellow their square root Proof Idea: n composite n = ab, 0 < a b < n