#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 2::4.6.3 Evaluation of Powers
#columns:Front	Back	Tags
TAOCP §4.6.3 Evaluation of Powers: what does it cover?	Computing x^n with as few multiplications as possible: the binary (square-and-multiply) method, and the deep theory of addition chains, which ask for the shortest sequence of additions reaching n.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::about
TAOCP §4.6.3: why does it matter?	Fast exponentiation is used everywhere from modular crypto to matrix powers for linear recurrences. Addition chains are a famous open-problem area that is easy to state.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::why
TAOCP §4.6.3, a common trap: “Assuming the binary method is optimal.” What's the catch?	Knuth shows small n where it is not.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::trap
TAOCP §4.6.3, exercise 1 (rated 15): what is it asking?	State the final value in the right-to-left binary method.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercise
TAOCP §4.6.3, exercise 3 (rated 22, recommended): what is it asking?	Compute one power by several methods and compare their costs.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercise
TAOCP §4.6.3, exercise 4 (rated M20): what is it asking?	A case where the octal method beats binary by a lot.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercise
TAOCP §4.6.3, exercise 5 (rated 24, recommended): what is it asking?	Build the power tree. Implement it.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercise
TAOCP §4.6.3, exercise 9 (rated 25, recommended): what is it asking?	Exponentiation with a window of e bits.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercise
TAOCP §4.6.3, exercise 26 (rated M25, recommended): what is it asking?	Large Fibonacci numbers modulo m quickly.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercise
TAOCP §4.6.3, exercise 30 (rated 20): what is it asking?	Allowing subtraction (division) in chains.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercise
TAOCP §4.6.3, exercise 11 (rated M26, recommended): what is it asking?	Find all optimal chains for two specific exponents. The stretch.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercise
TAOCP §4.6.3: how many exercises, and how are they rated?	42 exercises, rated 10 to M50.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::exercises
TAOCP §4.6.3: what should you be comfortable with first?	<ul><li>4.1 Positional Number Systems</li></ul>	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::prereqs
TAOCP §4.6.3: how should you work through it?	Implement right-to-left and left-to-right binary exponentiation and count multiplications. Then find the shortest addition chain for small n by brute force and compare to the binary method.	cracked.guide cracked.guide::phase::taocp-2 cracked.guide::section::4.6.3 cracked.guide::kind::approach
