This is a math problem, but I'm sure this must come up in some programming scenarios, at least I hope so, and I was wondering if there was a name for this type of situation:
Suppose I have 7 items in a series. For the sake of this example, let's use days of the week. I would like a user to submit which days of the week they plan to come in the following week. They are presented with a standard series of checkboxes, one for each day of the week.
I would like to store which days they choose in one database field as a single integer.
Obviously, I could assign each day a number, 1 - 7 (leaving 0 out in case the user leaves all choices unchecked). But then I run into problems if one user chooses Monday and Tuesday ( 1 + 2) and another chooses Wednesday (3).
I could also give each day of the week some bizarre unique such that it was impossible for any combination of digits to be identical to any other combination.
My hope is that rather than make up such a series for the second scenario, some numerical property already exists (perhaps the square of each number in the series, etc) that is already well-used and respected. Ideally, this would be so familiar to programming, that deriving the individual digits would take very little overhead of a common programming language (in my case PHP).
Did I just dream this up, or does something like this exist?