Distributing Series/Patterns

110 Views Asked by At

I'm going to do my best to explain this question, but it's complicated. Please bear with me. I'm trying to solve a practical problem and I know that the answer involves some math, but I can't for the life of me figure it out.

You've got a series of hexagons, and each side is numbered with a digit, 0 through 5, like this:

image of hexagons with numbered sides

If you give each hexagon a unique sequence of the digits 0 to 5 (i.e., 0-1-2-3-4-5, 0-1-2-3-5-4, 0-1-2-4-3-5, etc.), you'll get 120 unique hexagons. Here are all the combinations:

table of all 0-5 sequences

(The sequence loops around the hexagon, so for my purposes 0-1-2-3-4-5, 1-2-3-4-5-0, 2-3-4-5-0-1 are all the same sequence. I set them all to starting with 0 for simplicity's sake.)

When you've got the full list of these 6-digit sequences typed out, any 3-digit combination of those numerals occurs exactly 6 times as a subsequence. 1-2-3 occurs 6 times. 4-1-2 occurs 6 times. Etc.

So, we have 120 different hexagons, each with a unique sequence on it. I am going to label each one with a letter, A to F, like this:

image of 12 hexagons, each with a unique sequence of numbers at the edges. The hexagons are labeled A-B-C-D-E-F, A-B-C-D-E-F

So, there are 6 letters and 6 instances of each 3-digit subsequence. What I want to do is distribute the letter labels among the 120 unique hexagons in such a way that each of those letter labels coincides with each 3-digit combination exactly once. That is, if you were to find the 6 hexagons that contain a 4-1-6 sequence, each letter would be different. If you found the 6 3-2-1 hexagons, each letter would be different, and so on.

My intuition tells me that this is possible, but I cannot figure out how to make this happen. Help!!

1

There are 1 best solutions below

8
On BEST ANSWER

I've ran an exhaustive search (as Ben10's comment suggests) and the first solution was found after around $3\cdot10^5$ potential solution paths were discarded. Below is the found solution.

The labeled hexagon permutations, sorted in two different ways:

Sorted by permutations:      Sorted by labels:
([0, 1, 2, 3, 4, 5], 'A')    ([0, 1, 2, 3, 4, 5], 'A')
([0, 1, 2, 3, 5, 4], 'B')    ([0, 1, 3, 2, 5, 4], 'A')
([0, 1, 2, 4, 3, 5], 'C')    ([0, 1, 4, 5, 2, 3], 'A')
([0, 1, 2, 4, 5, 3], 'D')    ([0, 1, 5, 4, 3, 2], 'A')
([0, 1, 2, 5, 3, 4], 'E')    ([0, 2, 1, 4, 3, 5], 'A')
([0, 1, 2, 5, 4, 3], 'F')    ([0, 2, 3, 5, 1, 4], 'A')
([0, 1, 3, 2, 4, 5], 'E')    ([0, 2, 4, 1, 5, 3], 'A')
([0, 1, 3, 2, 5, 4], 'A')    ([0, 2, 5, 3, 4, 1], 'A')
([0, 1, 3, 4, 2, 5], 'B')    ([0, 3, 1, 5, 2, 4], 'A')
([0, 1, 3, 4, 5, 2], 'F')    ([0, 3, 2, 4, 5, 1], 'A')
([0, 1, 3, 5, 2, 4], 'C')    ([0, 3, 4, 2, 1, 5], 'A')
([0, 1, 3, 5, 4, 2], 'D')    ([0, 3, 5, 4, 1, 2], 'A')
([0, 1, 4, 2, 3, 5], 'D')    ([0, 4, 1, 3, 5, 2], 'A')
([0, 1, 4, 2, 5, 3], 'C')    ([0, 4, 2, 5, 1, 3], 'A')
([0, 1, 4, 3, 2, 5], 'F')    ([0, 4, 3, 1, 2, 5], 'A')
([0, 1, 4, 3, 5, 2], 'B')    ([0, 4, 5, 3, 2, 1], 'A')
([0, 1, 4, 5, 2, 3], 'A')    ([0, 5, 1, 2, 4, 3], 'A')
([0, 1, 4, 5, 3, 2], 'E')    ([0, 5, 2, 1, 3, 4], 'A')
([0, 1, 5, 2, 3, 4], 'D')    ([0, 5, 3, 1, 4, 2], 'A')
([0, 1, 5, 2, 4, 3], 'B')    ([0, 5, 4, 2, 3, 1], 'A')
([0, 1, 5, 3, 2, 4], 'F')    ([0, 1, 2, 3, 5, 4], 'B')
([0, 1, 5, 3, 4, 2], 'C')    ([0, 1, 3, 4, 2, 5], 'B')
([0, 1, 5, 4, 2, 3], 'E')    ([0, 1, 4, 3, 5, 2], 'B')
([0, 1, 5, 4, 3, 2], 'A')    ([0, 1, 5, 2, 4, 3], 'B')
([0, 2, 1, 3, 4, 5], 'D')    ([0, 2, 1, 5, 3, 4], 'B')
([0, 2, 1, 3, 5, 4], 'E')    ([0, 2, 3, 4, 1, 5], 'B')
([0, 2, 1, 4, 3, 5], 'A')    ([0, 2, 4, 5, 1, 3], 'B')
([0, 2, 1, 4, 5, 3], 'F')    ([0, 2, 5, 4, 3, 1], 'B')
([0, 2, 1, 5, 3, 4], 'B')    ([0, 3, 1, 5, 4, 2], 'B')
([0, 2, 1, 5, 4, 3], 'C')    ([0, 3, 2, 1, 4, 5], 'B')
([0, 2, 3, 1, 4, 5], 'C')    ([0, 3, 4, 5, 2, 1], 'B')
([0, 2, 3, 1, 5, 4], 'D')    ([0, 3, 5, 1, 2, 4], 'B')
([0, 2, 3, 4, 1, 5], 'B')    ([0, 4, 1, 2, 5, 3], 'B')
([0, 2, 3, 4, 5, 1], 'E')    ([0, 4, 2, 1, 3, 5], 'B')
([0, 2, 3, 5, 1, 4], 'A')    ([0, 4, 3, 2, 5, 1], 'B')
([0, 2, 3, 5, 4, 1], 'F')    ([0, 4, 5, 3, 1, 2], 'B')
([0, 2, 4, 1, 3, 5], 'F')    ([0, 5, 1, 4, 2, 3], 'B')
([0, 2, 4, 1, 5, 3], 'A')    ([0, 5, 2, 3, 1, 4], 'B')
([0, 2, 4, 3, 1, 5], 'E')    ([0, 5, 3, 2, 4, 1], 'B')
([0, 2, 4, 3, 5, 1], 'D')    ([0, 5, 4, 1, 3, 2], 'B')
([0, 2, 4, 5, 1, 3], 'B')    ([0, 1, 2, 4, 3, 5], 'C')
([0, 2, 4, 5, 3, 1], 'C')    ([0, 1, 3, 5, 2, 4], 'C')
([0, 2, 5, 1, 3, 4], 'C')    ([0, 1, 4, 2, 5, 3], 'C')
([0, 2, 5, 1, 4, 3], 'E')    ([0, 1, 5, 3, 4, 2], 'C')
([0, 2, 5, 3, 1, 4], 'F')    ([0, 2, 1, 5, 4, 3], 'C')
([0, 2, 5, 3, 4, 1], 'A')    ([0, 2, 3, 1, 4, 5], 'C')
([0, 2, 5, 4, 1, 3], 'D')    ([0, 2, 4, 5, 3, 1], 'C')
([0, 2, 5, 4, 3, 1], 'B')    ([0, 2, 5, 1, 3, 4], 'C')
([0, 3, 1, 2, 4, 5], 'F')    ([0, 3, 1, 2, 5, 4], 'C')
([0, 3, 1, 2, 5, 4], 'C')    ([0, 3, 2, 4, 1, 5], 'C')
([0, 3, 1, 4, 2, 5], 'E')    ([0, 3, 4, 5, 1, 2], 'C')
([0, 3, 1, 4, 5, 2], 'D')    ([0, 3, 5, 4, 2, 1], 'C')
([0, 3, 1, 5, 2, 4], 'A')    ([0, 4, 1, 3, 2, 5], 'C')
([0, 3, 1, 5, 4, 2], 'B')    ([0, 4, 2, 3, 5, 1], 'C')
([0, 3, 2, 1, 4, 5], 'B')    ([0, 4, 3, 1, 5, 2], 'C')
([0, 3, 2, 1, 5, 4], 'F')    ([0, 4, 5, 2, 1, 3], 'C')
([0, 3, 2, 4, 1, 5], 'C')    ([0, 5, 1, 4, 3, 2], 'C')
([0, 3, 2, 4, 5, 1], 'A')    ([0, 5, 2, 3, 4, 1], 'C')
([0, 3, 2, 5, 1, 4], 'D')    ([0, 5, 3, 2, 1, 4], 'C')
([0, 3, 2, 5, 4, 1], 'E')    ([0, 5, 4, 1, 2, 3], 'C')
([0, 3, 4, 1, 2, 5], 'D')    ([0, 1, 2, 4, 5, 3], 'D')
([0, 3, 4, 1, 5, 2], 'E')    ([0, 1, 3, 5, 4, 2], 'D')
([0, 3, 4, 2, 1, 5], 'A')    ([0, 1, 4, 2, 3, 5], 'D')
([0, 3, 4, 2, 5, 1], 'F')    ([0, 1, 5, 2, 3, 4], 'D')
([0, 3, 4, 5, 1, 2], 'C')    ([0, 2, 1, 3, 4, 5], 'D')
([0, 3, 4, 5, 2, 1], 'B')    ([0, 2, 3, 1, 5, 4], 'D')
([0, 3, 5, 1, 2, 4], 'B')    ([0, 2, 4, 3, 5, 1], 'D')
([0, 3, 5, 1, 4, 2], 'F')    ([0, 2, 5, 4, 1, 3], 'D')
([0, 3, 5, 2, 1, 4], 'E')    ([0, 3, 1, 4, 5, 2], 'D')
([0, 3, 5, 2, 4, 1], 'D')    ([0, 3, 2, 5, 1, 4], 'D')
([0, 3, 5, 4, 1, 2], 'A')    ([0, 3, 4, 1, 2, 5], 'D')
([0, 3, 5, 4, 2, 1], 'C')    ([0, 3, 5, 2, 4, 1], 'D')
([0, 4, 1, 2, 3, 5], 'E')    ([0, 4, 1, 5, 3, 2], 'D')
([0, 4, 1, 2, 5, 3], 'B')    ([0, 4, 2, 5, 3, 1], 'D')
([0, 4, 1, 3, 2, 5], 'C')    ([0, 4, 3, 2, 1, 5], 'D')
([0, 4, 1, 3, 5, 2], 'A')    ([0, 4, 5, 1, 2, 3], 'D')
([0, 4, 1, 5, 2, 3], 'F')    ([0, 5, 1, 3, 2, 4], 'D')
([0, 4, 1, 5, 3, 2], 'D')    ([0, 5, 2, 1, 4, 3], 'D')
([0, 4, 2, 1, 3, 5], 'B')    ([0, 5, 3, 4, 2, 1], 'D')
([0, 4, 2, 1, 5, 3], 'E')    ([0, 5, 4, 3, 1, 2], 'D')
([0, 4, 2, 3, 1, 5], 'F')    ([0, 1, 2, 5, 3, 4], 'E')
([0, 4, 2, 3, 5, 1], 'C')    ([0, 1, 3, 2, 4, 5], 'E')
([0, 4, 2, 5, 1, 3], 'A')    ([0, 1, 4, 5, 3, 2], 'E')
([0, 4, 2, 5, 3, 1], 'D')    ([0, 1, 5, 4, 2, 3], 'E')
([0, 4, 3, 1, 2, 5], 'A')    ([0, 2, 1, 3, 5, 4], 'E')
([0, 4, 3, 1, 5, 2], 'C')    ([0, 2, 3, 4, 5, 1], 'E')
([0, 4, 3, 2, 1, 5], 'D')    ([0, 2, 4, 3, 1, 5], 'E')
([0, 4, 3, 2, 5, 1], 'B')    ([0, 2, 5, 1, 4, 3], 'E')
([0, 4, 3, 5, 1, 2], 'E')    ([0, 3, 1, 4, 2, 5], 'E')
([0, 4, 3, 5, 2, 1], 'F')    ([0, 3, 2, 5, 4, 1], 'E')
([0, 4, 5, 1, 2, 3], 'D')    ([0, 3, 4, 1, 5, 2], 'E')
([0, 4, 5, 1, 3, 2], 'F')    ([0, 3, 5, 2, 1, 4], 'E')
([0, 4, 5, 2, 1, 3], 'C')    ([0, 4, 1, 2, 3, 5], 'E')
([0, 4, 5, 2, 3, 1], 'E')    ([0, 4, 2, 1, 5, 3], 'E')
([0, 4, 5, 3, 1, 2], 'B')    ([0, 4, 3, 5, 1, 2], 'E')
([0, 4, 5, 3, 2, 1], 'A')    ([0, 4, 5, 2, 3, 1], 'E')
([0, 5, 1, 2, 3, 4], 'F')    ([0, 5, 1, 3, 4, 2], 'E')
([0, 5, 1, 2, 4, 3], 'A')    ([0, 5, 2, 4, 1, 3], 'E')
([0, 5, 1, 3, 2, 4], 'D')    ([0, 5, 3, 1, 2, 4], 'E')
([0, 5, 1, 3, 4, 2], 'E')    ([0, 5, 4, 3, 2, 1], 'E')
([0, 5, 1, 4, 2, 3], 'B')    ([0, 1, 2, 5, 4, 3], 'F')
([0, 5, 1, 4, 3, 2], 'C')    ([0, 1, 3, 4, 5, 2], 'F')
([0, 5, 2, 1, 3, 4], 'A')    ([0, 1, 4, 3, 2, 5], 'F')
([0, 5, 2, 1, 4, 3], 'D')    ([0, 1, 5, 3, 2, 4], 'F')
([0, 5, 2, 3, 1, 4], 'B')    ([0, 2, 1, 4, 5, 3], 'F')
([0, 5, 2, 3, 4, 1], 'C')    ([0, 2, 3, 5, 4, 1], 'F')
([0, 5, 2, 4, 1, 3], 'E')    ([0, 2, 4, 1, 3, 5], 'F')
([0, 5, 2, 4, 3, 1], 'F')    ([0, 2, 5, 3, 1, 4], 'F')
([0, 5, 3, 1, 2, 4], 'E')    ([0, 3, 1, 2, 4, 5], 'F')
([0, 5, 3, 1, 4, 2], 'A')    ([0, 3, 2, 1, 5, 4], 'F')
([0, 5, 3, 2, 1, 4], 'C')    ([0, 3, 4, 2, 5, 1], 'F')
([0, 5, 3, 2, 4, 1], 'B')    ([0, 3, 5, 1, 4, 2], 'F')
([0, 5, 3, 4, 1, 2], 'F')    ([0, 4, 1, 5, 2, 3], 'F')
([0, 5, 3, 4, 2, 1], 'D')    ([0, 4, 2, 3, 1, 5], 'F')
([0, 5, 4, 1, 2, 3], 'C')    ([0, 4, 3, 5, 2, 1], 'F')
([0, 5, 4, 1, 3, 2], 'B')    ([0, 4, 5, 1, 3, 2], 'F')
([0, 5, 4, 2, 1, 3], 'F')    ([0, 5, 1, 2, 3, 4], 'F')
([0, 5, 4, 2, 3, 1], 'A')    ([0, 5, 2, 4, 3, 1], 'F')
([0, 5, 4, 3, 1, 2], 'D')    ([0, 5, 3, 4, 1, 2], 'F')
([0, 5, 4, 3, 2, 1], 'E')    ([0, 5, 4, 2, 1, 3], 'F')