For my problem I have 16 inputs, which can be switched on and off individually and an output that depends on the input combinations. I now want to store the output for each input combination in an one-dimensional-array. This is rather trivial to do if I store every possible input combination, since I can just use the binary coding. The combination 2x0000 0000 0000 1000 would be 10 as a decimal, so I store it as the tenth element of my array.
However, due to storage constraints, I just want to save the combinatons where at least one input is switched on, but also just up to a maximum of n inputs. As an example for a maximum of n=4 inputs, I would want to store "0010 0100 0101 0000" but not "0110 1111 0111 1001" if that makes sense.
So instead of storing all 2^16=65,536 combinations, I would only need to save 16c4=1,820 (Edit: This number is wrong I think, I can't use nCr here) combinations. But I can't use the binary coding anymore. For example my last entry would be 1111 0000 0000 0000, which is around 61,000 in decimal and not 1,820.
So how could I find this specific combination again?
Currently, I added a second column where I store the binary combination of inputs, but this yet again increases the storage demand. I also now have to search this column for the right combination, increasing computational load as well. I wonder if there is a sytem to store these combinations and recall them using the same system.