#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 1::1.2.5 Permutations and Factorials
#columns:Front	Back	Tags
TAOCP §1.2.5 Permutations and Factorials: what does it cover?	Counting arrangements, factorials, and how fast n! grows, including Stirling's approximation. Knuth also extends factorials to non-integers via the gamma function and shows how to count the power of a prime dividing n!.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::about
TAOCP §1.2.5: why does it matter?	Factorials set the lower bound for comparison sorting (you need about lg n! comparisons) and they tell you instantly when brute force over permutations is hopeless.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::why
TAOCP §1.2.5, a common trap: “Getting lost in the gamma function.” What's the catch?	It is optional depth for now.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::trap
TAOCP §1.2.5: what traps should you watch for?	<ul><li>Off-by-one between permutations of n things and arrangements of k out of n.</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::traps
TAOCP §1.2.5, exercise 1 (rated 00): what is it asking?	Count the orderings of a deck of cards. Warm-up.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercise
TAOCP §1.2.5, exercise 4 (rated 13, recommended): what is it asking?	Use a given log of a big factorial to get its digit count and its leading and trailing digits.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercise
TAOCP §1.2.5, exercise 5 (rated 15): what is it asking?	Estimate a small factorial with the refined Stirling formula and compare with the exact value.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercise
TAOCP §1.2.5, exercise 6 (rated 17, recommended): what is it asking?	Factor a factorial into primes with the prime-power formula, no multiplying out.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercise
TAOCP §1.2.5, exercise 11 (rated M15): what is it asking?	Count the factors of 2 in n! straight from the binary digits of n.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercise
TAOCP §1.2.5, exercise 12 (rated M22, recommended): what is it asking?	Generalize that to any prime using base-p digits.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercise
TAOCP §1.2.5, exercise 24 (rated HM21, recommended): what is it asking?	Prove simple upper and lower bounds for n! with e. Handy whenever you estimate.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercise
TAOCP §1.2.5, exercise 14 (rated M28, recommended): what is it asking?	Compute n! mod p from the base-p digits of n. The stretch.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercise
TAOCP §1.2.5: how many exercises, and how are they rated?	25 exercises, rated 00 to M28.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::exercises
TAOCP §1.2.5: what should you be comfortable with first?	<ul><li>1.2.3 Sums and Products</li><li>1.2.4 Integer Functions</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::prereqs
TAOCP §1.2.5: how should you work through it?	Read the counting arguments carefully and do them on small n. Compute a few values of Stirling's approximation against real n! to feel the error. The gamma function part is fine to read for the idea and skim the proofs.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.5 cracked.guide::kind::approach
