Math Fundamentals18 sections · 814 units
Open in Course

Lessons from Count Good Numbers

summary

1.1. Counting problems often reduce to exponentiation. If each position has kk choices and positions are independent, total count is knk^n.

2.2. When nn is large (>106> 10^6), use modular exponentiation. Direct computation will overflow or time out.

3.3. Ceiling and floor tricks for splitting positions: even positions = (n+1)/2(n + 1) / 2, odd positions = n/2n / 2 (integer division).