# Convert the decimal number 29 to binary system

For larger numbers, you could consult a table of powers of two to find the consecutive powers that contain your number. To see why this works, think of the binary representations of the integers 2 4 through 2 5 — 1, for example. They are through , all possible 5-bit values. The above method can be stated another way: You can state that mathematically as:.

How many bits do numbers in this range require? For example, consider four-digit decimal integers. The number of bits varies between those extremes. For example, requires 11 bits, requires 12 bits, and requires 13 bits. Why does this occur? Because that single power of ten range spans all or part of five consecutive power-of-two ranges. The minimum number of bits required for a d -digit integer is computed simply by using the specific number formula on the minimum d -digit value:.

The maximum number of bits required for a d -digit integer is computed simply by using the specific number formula on the maximum d -digit value:. This allows us to use this more computationally efficient formula to the same effect:.

The average number of bits required for a d -digit integer is the total number of bits required to represent all d -digit integers divided by the number of d -digit integers. For our example, the average is. First we have to figure out how to take the base-2 logarithm of a number.

Many programming environments do not have a base-2 logarithm function. You can deal with that by doing a change of base:. For larger numbers, you could consult a table of powers of two to find the consecutive powers that contain your number. To see why this works, think of the binary representations of the integers 2 4 through 2 5 — 1, for example. They are through , all possible 5-bit values.

The above method can be stated another way: You can state that mathematically as:. How many bits do numbers in this range require? For example, consider four-digit decimal integers. The number of bits varies between those extremes. For example, requires 11 bits, requires 12 bits, and requires 13 bits. Why does this occur? Because that single power of ten range spans all or part of five consecutive power-of-two ranges. The minimum number of bits required for a d -digit integer is computed simply by using the specific number formula on the minimum d -digit value:.

The maximum number of bits required for a d -digit integer is computed simply by using the specific number formula on the maximum d -digit value:.

This allows us to use this more computationally efficient formula to the same effect:. The average number of bits required for a d -digit integer is the total number of bits required to represent all d -digit integers divided by the number of d -digit integers.

For our example, the average is. First we have to figure out how to take the base-2 logarithm of a number. Many programming environments do not have a base-2 logarithm function. You can deal with that by doing a change of base:. Here are a few sample problems. By writing out the chart and placing the 1's and 0's under the proper place in the chart, all that is left is to add up the place values that have 1's under them and the total will be the decimal number value.

To convert decimal numbers to binary numbers, place 1's in the place values until all the place values with 1's add up to the total. If any numbered place adds a value that is larger than the decimal number, 0's should be placed in those place values. Another method for converting decimal numbers to binary numbers is the remainder method. Divide the decimal number by 2 and place write down a 1 if there is a remainder or a 0 if there is no remainder.

Then divide the answer by 2 and write down a 1 if there is a remainder or a 0 if there is no remainder. The division process continues until there are 8 bits or place values of 1's or 0's.

Be sure to write the 1's and 0's down in reverse order from right to left.