How Long Is 2 to the 100th?

  • Hard
  • Number puzzles
  • Tests: Using a logarithm to measure a number's length

The puzzle

2^10 = 1024, which has 4 digits. 2^20 has 7. How many digits does 2^100 have?

You are not asked for the number itself, only its length.

Stuck?

One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.

Hint 1

The number of digits of N is floor(log10 N) + 1.

Hint 2

log10 2 is about 0.30103, so log10 of 2^100 is about 30.1.

Show the answer Hide the answer

31 digits.

How to get there

A positive integer N has floor(log10 N) + 1 digits - that is just saying N sits between 10^30 and 10^31 if its logarithm is between 30 and 31.

log10(2^100) = 100 x log10 2 = 100 x 0.30103 = 30.103. The floor is 30, so 2^100 has 31 digits.

A quick sanity check without logarithms: 2^10 = 1024, just over 10^3, so 2^100 = (2^10)^10 is just over 10^30 - and "just over" by a factor of 1.024^10 = 1.27, which is nowhere near 10. So 31 digits, and the leading digit is 1. The actual value is 1267650600228229401496703205376.

The technique worth keeping

The logarithm measures length. Multiply the exponent by log10 of the base, take the floor and add one - and remember log10 2 = 0.301, which converts between bits and decimal digits in your head.