# Shortest Algorithm* That Generates a Harlequin Pattern

What is the shortest sequence of moves that, from the solved state of the cube, creates a pattern that meets the following criteria:

• 6 colors on each face
• at most 2 facelets of the same color
• no adjacent facelets of the same color

* In the Rubik's world, an algorithm is a sequence of moves, like: L, R, U, D, F, B etc.

• Related quesions: one, two, three Nov 24, 2023 at 8:08
• Fellow puzzlers, SPOILER is an algorithm that works. Don't look if you want to find a solution for yourself, but if you do look do let me know if you think you've found a mistake and potentially missed something shorter :) Nov 24, 2023 at 21:01
• @JonathanAllan Is it against the rules if you answer here? Nov 24, 2023 at 23:11
• No, but I've answered over on codegolf using programming, maybe someone will answer here by logical reasoning instead. Nov 25, 2023 at 2:09

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.