PROJECT EULER · #0981
The Quaternion Group II
Starting from an empty string, we want to build a string with letters "x", "y", "z". At each step, one of the following operations is performed:
- insert two consecutive identical letters "xx", "yy" or "zz" anywhere into the string;
- replace one letter in the string with two consecutive letters, according to the rule: "x"
"yz", "y" "zx", "z" "xy"; - exchange two consecutive different letters in the string, e.g. "xy"
"yx", "zx" "xz", etc.
A string is called neutral if it is possible to produce the string from the empty string after an even number of steps.
Let
For example,
Find the sum of
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.