0

I'm sure this is a known problem but it defies a Google search! I'm interested in the number of unique Tic-Tac-Toe boards in which all 9 squares are filled, even if they result in non-sensical games where both sides win. So the question is: With five white stones (O) and four black stones (X), how many distinct arrangements are there, given that all same-colored stones look exactly alike?

I'd be happy just to know what this variety of combinatorics is called, since it's something between a combination and a permutation. But I've worked out a bit of it:

Of course, we know there are 9! routes to the final state, but many will be identical in the end since the order in which the stones were placed is not evident in the final product.

Likewise, if we think of a given board as a nine-digit binary number, which 1s as Os and 0s as Xs, there are 512 possible combinations. But only those with exactly five 1s are valid.

We can reduce the problem to the unique number of arrangements of 4 black stones placed in 9 slots, since all the others will be white stones.

  • In cases where there is 1 stone placed somewhere in N slots, there are N possibilities.

  • In cases where there are 2 stones placed in N slots, the answer is the triangle number of N-1, or (N-1)N/2.

  • In cases where there are 3 stones placed in N slots, the answer is the sum of N-2 triangle numbers, which telescopes to to (n-2)(n-1)n/6

What I cannot figure out is how to generalize this to m stones in N slots, where N > m. Telescoping is always a trial-and-error process, so it would be absurd to progress sequentially from 1 to m for, say, 100 stones distributed across 150 slots. So perhaps a more general question is: When you have a formula in which each subsequent step is the sum of a sequence of the previous step, how can you progress without solving each sequence in turn?

Another way to address the problem is to say: Of every binary number from [0000]11111 to 111110000, how many have digits that sum to 5?

  • 2
    I think the answer to your first question is ${9}\choose{4}$. Once you specify where the 4 black stones are placed on the board (there are ${9}\choose{4}$ ways to do this), all white stones must go into the remaining slots. – Mike Jun 22 '19 at 04:29

1 Answers1

2

$${9 \choose 4} = {9 \choose 5} = 126,$$

assuming you don't invoke symmetries (i.e., stating that a board rotated 90 degrees, or flipped left-to-right, or flipped up-and-down, ...) are equivalent.

  • Thank you! These are binomial coefficients, yes? 126 is certainly the answer I get computationally. But you read my mind: My next step was to further reduce to any identical game that is rotated, flipped, etc. My plan was to subject each board to a series of matrix transforms. I suspect there's a more elegant way? – Chris Wilson Jun 22 '19 at 05:51