Recently I needed to calculate all the possible combinations for these modifier keys:

Alt, Control, Shift, Window (abbreviated as A,C,S,W)

…ranging from none of them to all four, and every combination in between. I didn’t want to miss any of them, so calculating the total number of possible combinations seemed like a good idea. (As you may have noticed, this was on a Windows computer, and no, I didn’t forget Caps Lock — it wasn’t relevant in this case.)

As it happens, there is a very simple formula, 2^x, where x represents the total number of objects, for counting all possible combinations (including none).

So, the answer was 2^4, or 16, as follows: A, AC, AS, AW, ACS, ACW, ASW, ACSW, C, CS, CW, CSW, S, SW, W and none. Continue reading