TAOCP 1.2.2 Exercise 19

A 14-digit decimal integer $n$ satisfies $10^{13} \le n < 10^{14}.$ A computer word with 47 bits and a sign bit has 47 bits available for the magnitude.

Section 1.2.2: Numbers, Powers, and Logarithms

Exercise 19. ▶ [20] If $n$ is an integer whose decimal representation is 14 digits long, will the value of $n$ fit in a computer word with a capacity of 47 bits and a sign bit?

Verified: yes
Solve time: 32s


Solution

A 14-digit decimal integer $n$ satisfies

$10^{13} \le n < 10^{14}.$

A computer word with 47 bits and a sign bit has 47 bits available for the magnitude. Hence the largest positive integer representable is

$2^{47} - 1.$

We compare $10^{14}$ with $2^{47}$. Since

$2^{10} = 1024 > 10^3,$

raising both sides to the fourth power gives

$2^{40} > 10^{12}.$

Also,

$2^7 = 128 > 100 = 10^2.$

Therefore

$2^{47} = 2^{40}2^7 > 10^{12} \cdot 10^2 = 10^{14}.$

Hence

$n < 10^{14} < 2^{47},$

so every 14-digit decimal integer fits within the available 47 magnitude bits.

Therefore the answer is

$\boxed{\text{yes}}.$