The air temperature is measured, which can be an integer from -30 to 34 degrees.

The air temperature is measured, which can be an integer from -30 to 34 degrees. What is the smallest number of bits needed to encode one measured value?

According to the condition of the problem, we need to store numbers from -30 to 34 inclusive, in total, including 0, we should store 65 different values. Next, we look at the smallest power of two, the value of which will be greater than or equal to what we need. The number 64 = 2 ^ 6 is not enough, so you have to use the power of 7 2 ^ 7 = 128, so 7 bits is the smallest number to encode the measured temperature.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.