# What's the name for this mathematical device used by programmers?

So a friend is trying to figure out what this is called so we can read more about it.

The concept is/was used by database designers, who needed a compact way to store a list of selected options as a single numerical value, where that number would be unique for any given selection of options.

This was done by assigning an ID value to each option that corresponded with an exponentiation of a base pair, and adding them all together. Since I'm not sure if anything I just said was correct, what I mean is (using base 2 as an example):

Option 1 ID: 1 (2^0)

Option 2 ID: 2 (2^1)

Option 3 ID: 4 (2^2)

So if your selection was both option 1 and 2, the value of that configuration would be 3 (1+2). If your selection was option 1 and 3, it would be 5 (1 + 4).

The presumed property here is that the resulting sum of any given configuration would be unique to that configuration, so that given the value of the sum, one would be able to work backwards to determine which option was selected.

This would be useful to, say, a database guy, who wants a compact way to store a list of selected options as a single value in a row of data.

• But the process is storing logical values, so binary arithmetic is wrong - we never add $a+b$ when $a$ and $b$ are bit fields. And it has nothing to do with base conversion. You never need to represent the number in another base. @Ken – Thomas Andrews May 12 '15 at 19:07
• @ThomasAndrews Given the OP said "using base 2 as an example", I thought to add the term "base conversion" for further reading. Maybe they never need a base beyond $2$, or one day they might. As for "binary arithmetic", it's not needed here for storage, but it might come up for manipulation purposes. – Ken May 12 '15 at 19:13