Counting digits: logarithms before anyone tells you about them
Helpful first: Exponents from Big and tiny numbers. Ready if you can say what 105 is, and why 102 × 103 = 105.
Tonight's idea
How many times do you multiply 1 by 10 to reach 1,000? Three. Mathematicians write \(\log_{10} 1000 = 3\) and say "the log of a thousand is three". \(\log_{10} 10 = 1\), \(\log_{10} 1{,}000{,}000 = 6\), \(\log_{10} 1 = 0\).
Numbers in between get logs in between. 500 is between 100 and 1,000, so its log is between 2 and 3 (it is about 2.7). This gives the first useful fact: the number of digits of a whole number is its log rounded down, plus 1. The log of 500 is 2.7, round down to 2, add 1: three digits.
The second fact is the one that changed history. Multiplying numbers adds their logs, because multiplying by 100 and then by 1,000 is multiplying by 10 five times: \(\log(100 \times 1000) = 2 + 3\). Before calculators, people multiplied big numbers by looking up logs in a book and adding.
A power is repeated multiplying, so it multiplies the log: \(\log 2^{100}\) is \(\log 2\) added a hundred times, \(100 \times \log 2\).
Two logs to memorise: \(\log_{10} 2 \approx 0.301\) and \(\log_{10} 3 \approx 0.477\). From those, by adding, you get a surprising number of others.
Logs are everywhere once you know to look. Decibels: +10 dB is ten times the sound intensity. Star brightness: astronomers' magnitudes are logs, with 5 magnitudes meaning a factor of 100 in light. Earthquake magnitudes and musical pitch are log scales too.
Watch one: how many digits in \(2^{100}\)?
\(\log_{10} 2^{100} = 100 \times \log_{10} 2 \approx 100 \times 0.301 = 30.1\). Round down to 30, add 1: 31 digits. (It is 1,267,650,600,228,229,401,496,703,205,376. Count them.)
Building logs by adding: \(\log 6 = \log 2 + \log 3 \approx 0.301 + 0.477 = 0.778\). \(\log 8 = \log 2 + \log 2 + \log 2 \approx 0.903\). \(\log 4 \approx 0.602\), \(\log 9 \approx 0.954\).
And subtracting: \(\log 5 = \log(10 / 2) = \log 10 - \log 2 = 1 - 0.301 = 0.699\).
Your turn
Tonight's core: the example and exercises 1, 2 and 4. The rest can wait for another visit.
- How many digits does \(2^{50}\) have? Show the log calculation.
- Using only \(\log 2\) and \(\log 3\), work out \(\log 12\), \(\log 15\) and \(\log 18\). (Hint: \(15 = 30 / 2\).)
- A quiet library is 40 dB; a vacuum cleaner is 70 dB. How many times more sound intensity is the vacuum cleaner?
- There are \(52!\) ways to shuffle a deck of cards (that is \(52 \times 51 \times \cdots \times 1\)). Given \(\log_{10} 52! \approx 67.9\), how many digits does \(52!\) have?
- A magnitude 1 star is 100 times brighter than a magnitude 6 star, the faintest you can see by eye. Each magnitude step is the same factor. Roughly what is that factor? (Try multiplying a guess by itself five times.)
- How many digits does \(3^{20}\) have? And \(6^{30}\)?
Stretch: why 1024 is "about a thousand"
Computer people say a kilobyte is 1,024 bytes and pretend it is 1,000. Show using logs why that is a reasonable lie: compute \(\log_{10} 2^{10}\) and compare it with 3.
Then estimate \(2^{64}\), the number of positions on a chessboard-doubling and the size of a 64-bit computer number, in the form "about \(a \times 10^b\)". Hint: \(64 \times 0.301 = 19.264\), so you need the number whose log is 0.264. You know \(\log 2 = 0.301\) is a bit too big; try 1.8 or so, and check by comparing with \(\log 2\) and \(\log 1.5 = \log 3 - \log 2\).
Answers
- \(50 \times 0.301 = 15.05\). Round down to 15, add 1: 16 digits. (\(2^{50} = 1{,}125{,}899{,}906{,}842{,}624\).)
- \(\log 12 = 2\log 2 + \log 3 \approx 1.079\). \(\log 15 = \log 3 + \log 10 - \log 2 = 0.477 + 1 - 0.301 = 1.176\). \(\log 18 = \log 2 + 2\log 3 \approx 1.255\).
- 30 dB more is three steps of ×10, so \(10^3 = 1{,}000\) times the intensity.
- Round 67.9 down to 67, add 1: 68 digits.
- About 2.5, since \(2.5^5 \approx 98\). The exact factor is \(100^{1/5} \approx 2.512\).
- \(20 \times 0.477 = 9.54\), so 10 digits (\(3^{20} = 3{,}486{,}784{,}401\)). \(30 \times 0.778 = 23.3\), so 24 digits.
Stretch. \(\log_{10} 2^{10} = 10 \times 0.301 = 3.01\), and \(\log_{10} 1000 = 3\). The logs differ by 0.01, so 1,024 is only about 2.4% more than 1,000; close enough for a nickname. For \(2^{64}\): the log is 19.264, so the answer is \(10^{0.264} \times 10^{19}\). \(\log 1.5 = 0.477 - 0.301 = 0.176\) is too small and \(\log 2 = 0.301\) is too big, so the number is between 1.5 and 2, nearer 2. Try \(1.8\): \(\log 1.8 = \log 18 - 1 = 0.255\). Close. So \(2^{64} \approx 1.8 \times 10^{19}\), a 20-digit number. The exact value is \(18{,}446{,}744{,}073{,}709{,}551{,}616\).