Sub topic 15
Estimating Logs and Counting Digits of Large Powers
This chapter assumes you know the definition of a logarithm and the product, quotient and power laws. It also assumes you can change base with the formula log_b(a) = log(a) / log(b). Here you apply those laws to two common CAT tasks. The first is finding roughly how big a logarithm is. The second is counting the digits of a huge number such as 2^100 without computing it.
Memorise a Few Base-10 Values
A CAT question that needs numeric logs usually supplies them, typically log10 2 = 0.3010 and log10 3 = 0.4771. Some papers give log10 7 as well. If the question gives none, you are not expected to estimate to four decimals. Learn these values and derive everything else from them.
| Number | log10 (approx.) | How to get it |
|---|---|---|
| 2 | 0.3010 | memorise |
| 3 | 0.4771 | memorise |
| 5 | 0.6990 | 1 − log 2, since 5 = 10/2 |
| 7 | 0.8451 | memorise |
| 4 | 0.6020 | 2 log 2 |
| 6 | 0.7781 | log 2 + log 3 |
| 8 | 0.9031 | 3 log 2 |
| 9 | 0.9542 | 2 log 3 |
| 12 | 1.0791 | 2 log 2 + log 3 |
Any number whose prime factors are 2, 3, 5 or 7 can be built from these values. The product and power laws do the work.
Characteristic and Mantissa
Write log10 N as a whole part plus a fractional part:
log10 N = n + f, where n is an integer and 0 ≤ f < 1.
Then N = 10^n × 10^f, with 1 ≤ 10^f < 10. The integer n is the characteristic. The fraction f is the mantissa. This gives two facts for N ≥ 1:
- The number of digits of N is n + 1, which is floor(log10 N) + 1.
- The leading digits of N come from 10^f. If f is about 0.30, then 10^f is about 2, so N starts with 2.
Counting Digits: Worked Examples
Example 1: 2^100. log10(2^100) = 100 × 0.3010 = 30.10. The characteristic is 30, so there are 31 digits. The mantissa 0.10 gives 10^0.10, about 1.26, so the number begins with 1. The exact value is 1.2676... × 10^30.
Example 2: 2^30 × 3^50. Add the logs:
30 × 0.3010 + 50 × 0.4771 = 9.030 + 23.855 = 32.885
The result has 33 digits.
Example 3: 5^30. Use log 5 = 0.6990. Then 30 × 0.6990 = 20.97, which gives 21 digits. The exact value is about 9.3 × 10^20.
Here is a check against exact integer arithmetic:
import math
def digits_by_log(base, exp):
return math.floor(exp * math.log10(base)) + 1
cases = [(2, 100), (3, 50), (5, 30), (7, 11), (12, 10), (10, 3)]
for base, exp in cases:
assert digits_by_log(base, exp) == len(str(base ** exp)), (base, exp)
print(base, exp, digits_by_log(base, exp))The last case, 10^3, is an exact power of 10. Its log is exactly 3 and the formula gives 4 digits, which is correct. The formula also works at exact powers of 10, because floor(3) + 1 = 4.
Edge Cases and Precision
Four-decimal logs are rounded values. If you multiply a rounded log by a large exponent, you multiply its error too.
- With log 2 = 0.3010 against the true 0.30103, the error is about 0.00003 per unit of exponent.
- For 2^1000, that error is about 0.03 in the product.
- The estimate 1000 × 0.3010 = 301.0 sits right at an integer boundary. The true value is 301.03, so the number has 302 digits.
- If you had used 0.3010 and got 301.0 exactly, you would be unsure between 301 and 302 digits.
When the fractional part lands within about 0.02 of a whole number, use more decimals, or find another route. The same caution applies in the other direction when the fraction is just under 1.
Leading Digit and Leading Zeros
To find the first digit, compute 10^f from the mantissa. Use the table: 10^0.301 = 2, 10^0.477 = 3, 10^0.602 = 4, 10^0.699 = 5, 10^0.778 = 6, 10^0.845 = 7, 10^0.903 = 8, 10^0.954 = 9. The first digit is the largest listed digit whose log does not exceed f.
For a number below 1, write log10 N = −m + f with 0 ≤ f < 1. Then N = 10^f × 10^(−m), so the first nonzero digit appears in the m-th place after the decimal point. The number of zeros directly after the decimal point is m − 1.
Example 4: 2^(−20).
- log10(2^(−20)) = −20 × 0.3010 = −6.02.
- Rewrite −6.02 as −7 + 0.98, so m = 7.
- 10^0.98 is about 9.5, so the number is about 9.5 × 10^(−7).
- That is 0.00000095..., with m − 1 = 6 zeros after the decimal point.
The exact value is 9.54 × 10^(−7), which confirms this.
Estimating a Logarithm in Another Base
For logb(a), use the change of base formula and then the table. First do a quick integer bracket. The integer part of logb(a) is the largest k with b^k ≤ a.
Example 5: log_5(200).
- Bracket: 5^3 = 125 ≤ 200 < 625 = 5^4, so the value lies between 3 and 4.
- Estimate: log 200 = 2 + 0.3010 = 2.3010, and log 5 = 0.6990, so the value is 2.3010 / 0.6990, about 3.29.
Example 6: log_2(100). The value is 2 / 0.3010, about 6.64. The bracket 2^6 = 64 ≤ 100 < 128 = 2^7 confirms that it lies between 6 and 7.
The bracket is a free sanity check on the division.
Smallest Exponent Problems
A frequent CAT form asks for the least n such that b^n exceeds some target. Take logs and divide by log b, which is positive for b > 1, so the inequality direction is preserved.
Example 7: least n with 7^n > 10^9.
- n × 0.8451 > 9, so n > 10.65.
- The least integer is n = 11.
- Check: 7^10 = 282,475,249, below 10^9, and 7^11 = 1,977,326,743, above it.
If the base is between 0 and 1, then log b is negative. Dividing by it reverses the inequality, which is the usual trap. For example, (1/2)^n < 10^(−6) gives −n × 0.3010 < −6, so n > 19.93, so n ≥ 20.
Common Mistakes
| Mistake | Fix |
|---|---|
| Using the integer part as the digit count | The count is the integer part plus 1 |
| Rounding log 2 to 0.3 for large exponents | Keep 0.3010 or more decimals when the exponent is in the hundreds |
| Treating the mantissa of a negative log as negative | Rewrite −6.02 as −7 + 0.98 before reading the leading digit |
| Forgetting that log 5 = 1 − log 2 | Write 5 as 10/2 |
| Not flipping an inequality when dividing by log of a base below 1 | Check the sign of log b first |
Exercises
Exercise
Given log10 2 = 0.3010 and log10 3 = 0.4771, how many digits does 12^10 have?
Show answer
log10 12 = 2(0.3010) + 0.4771 = 1.0791. Then 10 × 1.0791 = 10.791, so the number has 10 + 1 = 11 digits. The exact value, 61,917,364,224, has 11 digits.
Exercise
Given log10 2 = 0.3010, how many zeros appear directly after the decimal point in 2^(−50)?
Show answer
log10(2^(−50)) = −15.05 = −16 + 0.95. So m = 16, and the number is about 8.9 × 10^(−16). The number of zeros after the decimal point is m − 1 = 15.
Exercise
Given log10 2 = 0.3010 and log10 3 = 0.4771, find the least integer n such that 6^n has at least 20 digits.
Show answer
At least 20 digits means 6^n ≥ 10^19. Then n × 0.7781 ≥ 19, so n ≥ 24.42, and the least integer is n = 25. Check: 24 × 0.7781 = 18.67, which gives 19 digits, and 25 × 0.7781 = 19.45, which gives 20 digits.