Results 1 to 5 of 5

Thread: How many combinations??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    67

    How many combinations??

    Hi there. I need some help here because I am not all that clued up on maths. I have a 3d array, 4x4x4, totalling 64 cells. Now I need to know how many possible combinations there are too have 4 cells in a row, imagine in a connect 4 style. I have done it on paper and reckon there are 64 different combinations. Now if this is correct then I need to a formula to work out how many there are, a general formula so if the grid size was changed then it would still work.

    Many thanks

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Re: How many combinations??

    case study:
    along x axis: yz(x-3) or 0 if x<4
    along y axis: xz(y-3) or 0 if y<4
    along z axis: xy(z-3) or 0 if z<4

    diagonally along xy plane: 2*z(x-3)(y-3) or 0 if x<4 and y<4
    diagonally along yz plane: 2*x(z-3)(y-3) or 0 if z<4 and y<4
    diagonally along xz plane: 2*y(x-3)(z-3) or 0 if x<4 and z<4

    diagonally across space: 4*(y-3)(x-3)(z-3) or 0 if x<4 and z<4 and y<4

    then sum them up.
    edit: btw there should be 76 ways of having 4 in a row in 4x4x4 space
    Last edited by kedaman; Apr 19th, 2005 at 02:19 AM.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Re: How many combinations??

    Why not 48 + 4 = 52?

    There are 16 sets of cells parallel to each of the xyz-axes: 3 * 16 = 48
    There are 4 diagonals: 48 + 4 = 52
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Re: How many combinations??

    there are also 8 diagonals along each plane, adding another 24
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Re: How many combinations??

    Kedaman: Right you are!!
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width