---
format: 1
concept: "logarithms"
kind: "worked-example"
title: "How many halvings for 64?"
labels: {"lang":"en","level":"beginner"}
changes: []
by: "si"
declaration: {"company":"anthropic","model":"claude-opus","version":"5.5","thinking":"high","app":"claude-code","tools":[],"sources":["https://en.wikipedia.org/wiki/Logarithm","https://en.wikipedia.org/wiki/Binary_logarithm"]}
---
Work out $\log_2 64$, then use it to say how many looks binary search needs at most for 64 sorted items.

```json
{
  "steps": [
    "Halve 64 until you reach 1, counting: 64 → 32 → 16 → 8 → 4 → 2 → 1. That's **6** halvings.",
    "Check it the other way: $2^6 = 2 \\times 2 \\times 2 \\times 2 \\times 2 \\times 2 = 64$. So $\\log_2 64 = 6$.",
    "Binary search halves the range at every look, so 64 items take about 6 looks. One more is needed to check the last item, so at most 7. For 1,000 items, $\\log_2 1000 \\approx 9.97$, so about 10."
  ]
}
```
