The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Possible arrangments of 5 switches

ValcienValcien Registered User regular
edited February 2010 in Help / Advice Forum
Does anyone know the formula to determine the possible permutations of a given number of switches?
In other words each switch a, b, c, d or e is either on or off. Order doesn't matter.

In figuring it out for five, this is what I have so far:

xxxxx
xxxxo
xxxoo
xxooo
xoooo
ooooo
oooox
oooxx
ooxxx
oxxxx
xoxox
oxoxo
oxooo
ooxoo
oooxo
xoxxx
xxoxx
xxxox
xooox
oxxxo
xooxx
oxxoo
xxoox
ooxxo
xoxoo
oxoxx
xxoxo
ooxox

That's 28. How many would there be for six? Seven? And did I miss any?

This is for a starcraft map.

Valcien on

Posts

  • DaenrisDaenris Registered User regular
    edited February 2010
    2^n where n is number of switches.

    So for 5 it's 32 possible combinations.

    edit:
    xxxxx
    xxxxo
    xxxox
    xxxoo
    xxoxx
    xxoxo
    xxoox
    xxooo
    xoxxx
    xoxxo
    xoxox
    xoxoo
    xooxx
    xooxo
    xooox
    xoooo
    oxxxx
    oxxxo
    oxxox
    oxxoo
    oxoxx
    oxoxo
    oxoox
    oxooo
    ooxxx
    ooxxo
    ooxox
    ooxoo
    oooxx
    oooxo
    oooox
    ooooo

    Is the actual list of solutions for 5.

    Daenris on
  • MetalbourneMetalbourne Inside a cluster b personalityRegistered User regular
    edited February 2010
    I'm guessing that there'd be 2^5 combinations, if I'm doing that right.

    Metalbourne on
  • ecco the dolphinecco the dolphin Registered User regular
    edited February 2010
    The formula would be

    2^(number of switches)

    So you should have a total of 32 for 5 switches, 64 for 6 switches, 128 for 7 switches.

    Edit: Woah, beaten. Well played gents, well played.

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • exmelloexmello Registered User regular
    edited February 2010
    That's a really strange pattern you laid those combinations out in. Maybe expecting all non-technical people to think in binary is my fault.

    exmello on
  • TelMarineTelMarine Registered User regular
    edited February 2010
    exmello wrote: »
    That's a really strange pattern you laid those combinations out in. Maybe expecting all non-technical people to think in binary is my fault.

    I was going to say exactly like this. Think in binary (1,2,4,8,16,32,etc.)

    TelMarine on
    3ds: 4983-4935-4575
  • MurphysParadoxMurphysParadox Registered User regular
    edited February 2010
    And if the switches can be set to on, off, or unknown, then it is 3^5. In fact, it is (number of positions a single element can have)^(number of said elements). This is for like elements. If you had X switches (on/off) and Y dials (5 settings), you'd say (2^X) * (5^Y).

    A more complicated version of this exists for sets such as a deck of cards (where you are removing elements as you go). I loved my discrete math class in college. Unfortunately, it is a dark voodoo which exits the brain upon completion of the semester.

    Good times.

    MurphysParadox on
    Murphy's Law: Whatever can go wrong will go wrong.
    Murphy's Paradox: The more you plan, the more that can go wrong. The less you plan, the less likely your plan will succeed.
  • ValcienValcien Registered User regular
    edited February 2010
    I feel really, really dumb for not figuring this out. It seems so obvious...

    Thanks muchly guys.

    I just typed five X's or O's over and over to get all the possibilities in a trial and error fashion. If that's thinking in binary than look what I can do. :winky:

    Valcien on
  • KlorgnumKlorgnum Registered User regular
    edited February 2010
    Valcien wrote: »
    I just typed five X's or O's over and over to get all the possibilities in a trial and error fashion. If that's thinking in binary than look what I can do. :winky:

    A better way to order it (with only three switches, because I'm lazy) would be:
    000 0
    001 1
    010 2
    011 3
    100 4
    101 5
    110 6
    111 7

    Where 1 is on and zero is off. Note the patterns in the columns - The least significant bit (rightmost) alternates on and off. One full cycle of on and offs toggles the middle bit, which has a pattern of two off and two on. One full cycle of that toggles the most significant bit.

    Klorgnum on
  • MetalbourneMetalbourne Inside a cluster b personalityRegistered User regular
    edited February 2010
    In the fifth grade I was taught to draw a box for each "digit"

    then in each box, put the number of possible answers for it (in this case 2; on and off)

    Then multiply all the boxes together and you have the number of possible combinations.

    Metalbourne on
  • DemerdarDemerdar Registered User regular
    edited February 2010
    Yup, it helps to draw little place markers for each element such as this:

    _ _ _ _ _

    and then in each element, think about what you are doing. How many different things can go into this element? 2 (either on or off). What about the next element? Well, you still have two choices, either on or off.

    After you fill all of the elements, you multiply them together.

    2 * 2 * 2 * 2 * 2 = 2^5

    And there you go.

    Let's do it now for the alphabet. Aka how many combination of 5 letters can you make, given you can reuse the same letter (as in aaaaa counts).

    Make your elements:
    _ _ _ _ _

    Then put numbers in your elements. (26 possible letters in the alphabet.. contrast this to 2 possible positions in a switch (either on or off))

    26 * 26 * 26 * 26 * 26 = 26^5

    Not too bad.

    Demerdar on
    y6GGs3o.gif
  • ChanusChanus Harbinger of the Spicy Rooster Apocalypse The Flames of a Thousand Collapsed StarsRegistered User, Moderator mod
    edited February 2010
    In the fifth grade I was taught to draw a box for each "digit"

    then in each box, put the number of possible answers for it (in this case 2; on and off)

    Then multiply all the boxes together and you have the number of possible combinations.

    That's a rather visual representation of 2^n :)

    Chanus on
    Allegedly a voice of reason.
  • MetalbourneMetalbourne Inside a cluster b personalityRegistered User regular
    edited February 2010
    Demerdar wrote: »
    Yup, it helps to draw little place markers for each element such as this:

    _ _ _ _ _

    and then in each element, think about what you are doing. How many different things can go into this element? 2 (either on or off). What about the next element? Well, you still have two choices, either on or off.

    After you fill all of the elements, you multiply them together.

    2 * 2 * 2 * 2 * 2 = 2^5

    And there you go.

    Let's do it now for the alphabet. Aka how many combination of 5 letters can you make, given you can reuse the same letter (as in aaaaa counts).

    Make your elements:
    _ _ _ _ _

    Then put numbers in your elements. (26 possible letters in the alphabet.. contrast this to 2 possible positions in a switch (either on or off))

    26 * 26 * 26 * 26 * 26 = 26^5

    Not too bad.

    It's even more useful if you have a situation where you can't reuse the same letter. You'd end up with something like 26*25*24*23*22

    And they could throw a hook in there where theyd ask for the number of possible five digit numbers that don't reuse the same digit: 9*9*8*7*6

    Or trying to figure out how many area codes there are: 9*2*9

    Metalbourne on
  • musanmanmusanman Registered User regular
    edited February 2010
    It's the multiplication counting principle. When you first learn it you're like "you have 3 shirts, 6 pairs of pants, and 8 ties how many outfits can you wear." You just multiply the number of each choice you have.

    If you can make a tree diagram for it, you should multiply!

    musanman on
    sic2sig.jpg
  • MetalbourneMetalbourne Inside a cluster b personalityRegistered User regular
    edited February 2010
    but one of the shirts is a tshirt and two pairs of pants are white and it's after labor day!

    Metalbourne on
  • KhavallKhavall British ColumbiaRegistered User regular
    edited February 2010
    Valcien wrote: »
    I just typed five X's or O's over and over to get all the possibilities in a trial and error fashion. If that's thinking in binary than look what I can do. :winky:

    No, the point was that you weren't thinking in Binary, which not only made it confusing to look at, but had you missing a few.

    Count in binary and it goes like this:
    1
    10
    11
    100
    101
    110
    111
    1000
    etc.

    Other way to look at it:
    (00000)
    (0000)1
    (000)10
    (000)11
    (00)100
    (00)101
    (00)110
    (00)111
    (0)1000
    etc.

    Now just replace the 1s and 0s with xs and os if that's what you want to use
    xxxxx
    xxxxo
    xxxox
    xxxoo
    xxoxx
    xxoxo
    xxoox
    xxooo
    etc.

    Khavall on
  • edited February 2010
    Chanus wrote: »
    In the fifth grade I was taught to draw a box for each "digit"

    then in each box, put the number of possible answers for it (in this case 2; on and off)

    Then multiply all the boxes together and you have the number of possible combinations.

    That's a rather visual representation of 2^n :)

    It sounds like it's more intended for multiple combinations (like, you're trying to figure out how many different outfits you can make with 3 pairs of pants, 8 shirts and 7 pairs of shoes). It's called combinatorics.

    http://www.youtube.com/watch?v=w0i_ZFlGTVY

    Richard M. Nixon on
    chevy.jpgsteve.jpgmartin.jpg
Sign In or Register to comment.