# Shortest Algorithm That Generates a Harlequin* Pattern

1. What is the shortest possible length of an algorithm that generates on each side of the cube a pattern that has:

• 6 colors
• at most 2 facelets of the same color
• no adjacent facelets of the same color
2. What is the algorithm (or algorithms)?

* I don't know if that's how such a pattern is called but I had to keep the title as concise and as descriptive as possible.

While I was was sieving through hundreds of patterns, using Herbert Kociemba's Cube Explorer, I stumbled upon a pattern, shown in the animation* below, that can be generated by a 15-move algorithm. But I don't know if this is the shortest algorithm which generates a harlequin pattern.

D' F L2 D F U2 B U' R' L F B L2 D L'

UPDATE – I found another one!
F R B D B F2 R2 U2 L' F' L D2 B R2 U

Today I decided to systematically search for the shortest harlequin algorithm using Kociemba's program. I started by manually counting the number of harlequin search patterns to be used in the Pattern Editor. There are 7 ways to arrange the first 2 facelets of the 1st color (excluding rotation symmetry):

For patterns 1 and 5 there are only 13 ways to arrange the next 2 facelets of the 2nd color:

For patterns 2, 6 and 7 there are 15 ways to arrange the 2nd color facelet pair. For patterns 3 and 4 there are 14 ways.

So, there are 99 ways in which the first 4 facelets can be arranged. For pattern 1 I counted 80 ways in which the 3rd color facelet pair can be placed. Because the colors of the search pattern only tell the program the structure of the pattern and not the actual colors to be searched, it doesn't matter how we color the last 3 facelets as long as each has a unique color. So there are 80 search patterns that begin with pattern 1. Pattern 2 is the starting point for 110 search patterns. Pattern 3 generates 94 search patterns. But I ran into a roadblock. Some search patterns produce 7 results, some 164 and some... OVER 9000!!

I had to stop the program after letting it run for more than 24 hours. It was still searching for patterns.

Obviously, it is unfeasible to manually search for the shortest harlequin generator. I hope someone will find a better way to answer this question. I understand that the number of harlequin patterns may be so large that it renders such patterns as... not so special to worth the effort of investigating. I don't know enough math to go any further.

I am still interested in a mathematical solution to this puzzle.

* GIF created using Rubik's Cube Explorer and VirtualDub.