I am a linguist, not a mathematician, so I apologize if there's something wrong with my terminology and/or notation.
I'm trying to decompose a set of k elements into unique binary vectors (sequences of 0's and 1's) and I'd like to know how to calculate the minimum vector length I need for that. For example, if I have 2 elements, then I only need vectors of length 1 ([0] and [1]), if I have 6 elements, I need vectors of length 3 ([0, 0, 0], [0, 0, 1], ..., [1, 1, 1]), etc.
Here are a few example vector lengths:
+-------+-----+
| k | len |
+-------+-----+
| 2 | 1 |
| 3-4 | 2 |
| 5-8 | 3 |
| 9-16 | 4 |
| 17-32 | 5 |
| 33-64 | 6 |
+------+------+
All I can see is that by subtracting the first number from the last of each range (4-3, 8-5, etc.) I get the Mersenne numbers, but I don't see how that's relevant.
The minimum vector length to distinguish k elements is the smallest n such that $2^n\geq k$, or $n=\lceil\log_2k\rceil$. (If not, then you would have to assign two elements the same vector!) The range of k values for a given n is irrelevant.
While this equation is simple, n limits the number of vectors (or any other type of object) that can be stored. This has had implications for the computer representation of integers, where n = 8 and n = 32 have led to the split-screen of Pac-Man and the exhaustion of IPv4 addresses – both noteworthy in their own right.