#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 1::1.2.7 Harmonic Numbers
#columns:Front	Back	Tags
TAOCP §1.2.7 Harmonic Numbers: what does it cover?	The harmonic numbers H_n = 1 + 1/2 + ... + 1/n, how they grow like ln n, and how to sum expressions involving them. They show up whenever you average over random positions.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::about
TAOCP §1.2.7: why does it matter?	H_n is behind the average cost of quicksort, the expected number of times a running maximum changes, and the coupon collector problem. You will see it constantly in Vol 3.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::why
Harmonic numbers: what is it?	The n-th harmonic number is H(n) = 1 + 1/2 + 1/3 + ... + 1/n, which grows like the natural logarithm of n plus Euler's constant (about 0.5772).	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::definition
Harmonic numbers: Is H(n) the same as log n?	Not exactly, but close: H(n) is ln n plus Euler's constant plus a correction that shrinks like 1/(2n).	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::definition
TAOCP §1.2.7: what traps should you watch for?	<ul><li>Confusing H_n with ln n exactly; the difference tends to Euler's constant, it does not vanish.</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::traps
TAOCP §1.2.7, exercise 2 (rated 13): what is it asking?	Adapt the text's halving argument to get an upper bound on the harmonic numbers.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercise
TAOCP §1.2.7, exercise 4 (rated 10, recommended): what is it asking?	Decide which inequalities between H_n and ln n hold for every n.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercise
TAOCP §1.2.7, exercise 5 (rated 15): what is it asking?	Compute a large harmonic number to many places from the asymptotic formula.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercise
TAOCP §1.2.7, exercise 9 (rated M18, recommended): what is it asking?	Check an edge case of the section's main summation theorem.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercise
TAOCP §1.2.7, exercise 11 (rated M21, recommended): what is it asking?	Practice summation by parts on a sum involving H_k.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercise
TAOCP §1.2.7, exercise 12 (rated M10, recommended): what is it asking?	A precision question that turns out to be easy once you see how fast the terms vanish.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercise
TAOCP §1.2.7, exercise 15 (rated M23, recommended): what is it asking?	Find a closed form for the sum of the first n harmonic numbers squared.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercise
TAOCP §1.2.7, exercise 19 (rated M30, recommended): what is it asking?	Find every n for which H_n is an integer, using a parity argument. The stretch.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercise
TAOCP §1.2.7: how many exercises, and how are they rated?	24 exercises, rated 01 to M33.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::exercises
TAOCP §1.2.7: what should you be comfortable with first?	<ul><li>1.2.3 Sums and Products</li><li>1.2.2 Logarithms</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::prereqs
TAOCP §1.2.7: how should you work through it?	Short section. Compute H_n for n up to 10 and compare to ln n + 0.577. Work through the summation by parts style manipulations with pencil.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.2.7 cracked.guide::kind::approach
