#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 2::4.5.4 Factoring into Primes
#columns:Front	Back	Tags
TAOCP §4.5.4 Factoring into Primes: what does it cover?	Methods for factoring integers and testing primality: trial division, Fermat's method, Pollard's rho, probabilistic primality testing, and the connection to public-key cryptography (RSA), plus a look at more advanced sieving methods.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::about
TAOCP §4.5.4: why does it matter?	Primality testing and the hardness of factoring are the foundation of RSA. Pollard rho is also a neat use of cycle detection.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::why
TAOCP §4.5.4, a common trap: “Overflow in modular multiplication.” What's the catch?	Use 128-bit intermediates or bignums.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::trap
TAOCP §4.5.4: what traps should you watch for?	<ul><li>Treating a probabilistic test as deterministic.</li></ul>	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::traps
TAOCP §4.5.4, exercise 1 (rated 10): what is it asking?	Why composite trial divisors never show up in the output.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercise
TAOCP §4.5.4, exercise 5 (rated 21): what is it asking?	Fermat's method by hand on a five-digit number.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercise
TAOCP §4.5.4, exercise 8 (rated 23, recommended): what is it asking?	The sieve of Eratosthenes and how to do it well. Implement it.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercise
TAOCP §4.5.4, exercise 10 (rated M26, recommended): what is it asking?	Selfridge's test for proving primality from the factors of n - 1.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercise
TAOCP §4.5.4, exercise 19 (rated M25, recommended): what is it asking?	Pollard's p - 1 idea. Another factoring method to implement.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercise
TAOCP §4.5.4, exercise 26 (rated M25, recommended): what is it asking?	Pocklington's primality certificate.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercise
TAOCP §4.5.4, exercise 38 (rated 25): what is it asking?	Find the largest 50-digit primes made mostly of one digit. A fun programming exercise with Miller-Rabin.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercise
TAOCP §4.5.4, exercise 22 (rated M30, recommended): what is it asking?	Bound the error rate of the probabilistic primality test. The stretch.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercise
TAOCP §4.5.4: how many exercises, and how are they rated?	47 exercises, rated 10 to M50.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::exercises
TAOCP §4.5.4: what should you be comfortable with first?	<ul><li>4.5.2 The Greatest Common Divisor</li><li>4.3.2 Modular Arithmetic</li></ul>	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::prereqs
TAOCP §4.5.4: how should you work through it?	Implement trial division, Pollard rho (with Floyd's cycle detection) and a Miller-Rabin primality test. Factor some 20-digit numbers. Read the advanced methods for the ideas only.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.5.4 cracked.guide::kind::approach
