# Binary digit problem?

Question:

If a system has $32k$ bytes and each such byte has unique address(so $32k$ addresses), what is the smallest possible bits that can be use by every byte for the address ? All the bytes use the same number of bits for the address.

I thought the answer can be found by finding the value to which $2$ can be raised such that it equals $32,000$. I got $2$ raised to $\sim 14.96$ gives $32,000$. But a byte only has $8$ bits so this can't make any sense.

Can anyone give any pointer on how to solve this problem ?

• 8 bits only gives you 256 distinct values, to address distinct 32.000 locations you do need more than 8 bits. In fact, your answer is (nearly) correct. Why do you reject your current approach? – Tom van der Zanden Feb 4 '15 at 8:37
• @TomvanderZanden I thought a byte must have only 8 bits. How is it possible that 15 bits per byte is used for address ? Please clarify. – Jenna Maiz Feb 4 '15 at 14:28
• Even if you'd like to keep your addresses byte-aligned then simply take the ceiling of the necessary number of bits and round that to the next highest multiple of 8 (and pad whatever portion of the remaining byte you would not need). In your case, you would need at least 15 bits so if you were to have to answer in bytes then you'd need 2 bytes per address. – Francesco Gramano Mar 7 '15 at 2:46
• "32k bytes" usually means "32x1024 bytes" (which is 32768 = 2^15), not "32000 bytes". – David Richerby May 5 '15 at 16:58

$2^{15} = 32768$, so if we let addresses be 15 bit we have the address space $[0,32767]$.