Exponents
An exponent counts repeated multiplication. 2⁶ means six 2s multiplied: 2×2×2×2×2×2 = 64. Start from 1 and double six times. The exponent counts the doublings, and the board lights 1, 2, 4, 8, 16, 32, then 64 squares.
Walk the powers backwards and each step divides by 2: 2² = 4, 2¹ = 2, 2⁰ = 1. That is why 2⁰ is 1, not 0. One more step gives a fraction: 2⁻¹ = 1/2.
Multiplying powers of the same base adds their exponents: 2² × 2⁴ = 4 × 16 = 64 = 2⁶, and 2 + 4 = 6. Two doublings and then four more are six doublings in all.
Logarithms
A logarithm asks the reverse question. log₂(64) means: 2 to what power gives 64? Find 64 among the powers of 2. It sits in the 2⁶ cell, so log₂(64) = 6. A log always answers with an exponent.
A log also counts halvings. To find item 22 among 64 sorted items, check the middle and keep the half that holds it. After six halvings one item is left, so log₂(64) = 6. This is binary search.
Exponents add when powers multiply, so logs turn multiplication into addition: log₂(4 × 16) = log₂ 4 + log₂ 16 = 2 + 4 = 6. This product rule works for any positive numbers, not just powers of 2.
Real sizes
Most numbers are not exact powers of 2. 1000 lies between 2⁹ = 512 and 2¹⁰ = 1024, so log₂(1000) ≈ 9.97. Its whole part, 9, plus one gives 10: the number of bits 1000 needs in binary.
Logs grow very slowly. 2²⁰ = 1,048,576, just over a million, so log₂ of a million is about 19.9. Binary search through a million sorted items needs at most 20 checks. Reading them one by one could take a million.
Logs work in any base. log₁₀(1000) = 3, because 10³ = 1000: count the zeros. Changing base only multiplies a log by a fixed number, about 3.32 from base 10 to base 2. So growth estimates often just write log n.
Try it in the Python prompt
;; step 1/9 · Exponents: repeated doubling >>> 2 ** 6 64 >>> 2 * 2 * 2 * 2 * 2 * 2 64 >>> [2 ** i for i in range(7)] [1, 2, 4, 8, 16, 32, 64]
log₂ and 2ˣ undo each other: log₂(2ˣ) = x and 2 to the power log₂(x) is x again. A log is only defined for numbers greater than 0. Use math.log2 and math.log10 for exact powers: math.log(1000, 10) divides two rounded logs and gives 2.9999999999999996, a tiny floating-point error.