What's the longest length of a month?
Try 2^1, 2^2, 2^3 until you get a number larger than the length of a month. That will tell you how many bits you need.
In this case, 2^5 is 32, so you need 5 bit words to represent the days of the month.
2007-05-23 10:48:39
·
answer #1
·
answered by Bob G 6
·
0⤊
0⤋
Maximum value = 31: 31 = 2^5-1 so you need 5 bits
11111 = 1+2+4+8+16 = 31
2007-05-23 17:48:49
·
answer #2
·
answered by welcome news 6
·
1⤊
0⤋
A five-bit "nybble" could do this nicely. This will allow you to count any number from 1 to 31 exactly. For example, the 1st of the monthy would code as 00001, and the 21st as 10101. The 31st will be all ones as 11111.
The months from 1 to 12 will take a four-bit nybble, with December coding as 1100.
2007-05-23 17:54:19
·
answer #3
·
answered by Don E Knows 6
·
0⤊
0⤋
You need to be able to express 1-31 so you are under 32 choices. The number of bits needed to express 32 choices is 5.
2007-05-23 17:52:38
·
answer #4
·
answered by Rich Z 7
·
0⤊
0⤋