In[]:=
AllInits[count_] := Tuples[{Range[0, 2], IntegerDigits[#, 2, count] & /@ Range[0, 2^count - 1]}]
In[]:=
TagSystemGenerationsCompiled = FunctionCompile[Function[{ Typed[initPhase, "MachineInteger"], Typed[initState, TypeSpecifier["PackedArray"]["MachineInteger", 1]]}, Module[{ TagSystemNextGeneration, j, states}, TagSystemNextGeneration = Function[{initStateAndPhase}, Module[{newState, phase, newPhase, i}, newState = CreateDataStructure["DynamicArray"]; phase = initStateAndPhase["Part", -1]; For[i = 1, i < initStateAndPhase["Length"], ++i, newPhase = -1; If[initStateAndPhase[[i]] 0 && phase 0, newState["Append", 0]; newPhase = 1; ]; If[initStateAndPhase[[i]] 0 && phase 1, newState["Append", 0]; newPhase = 2; ]; If[initStateAndPhase[[i]] 0 && phase 2, newPhase = 0; ]; If[initStateAndPhase[[i]] 1 && phase 0, newState["Append", 1]; newState["Append", 1]; newPhase = 2; ]; If[initStateAndPhase[[i]] 1 && phase 1, newState["Append", 1]; newPhase = 0; ]; If[initStateAndPhase[[i]] 1 && phase 2, newState["Append", 0]; newPhase = 1; ]; phase = newPhase; ]; newState["Append", phase] ]]; states = CreateDataStructure["DynamicArray"]; states["Append", CreateDataStructure["DynamicArray"]]; For[j = 1, j ≤ Length[initState], ++j, states["Part", 1]["Append", initState[[j]]]; ]; states["Part", 1]["Append", initPhase]; While[states["Length"] < 2 || Not[states["Part", -1] === states["Part", -2]], states["Append", TagSystemNextGeneration[states["Part", -1]]]; ]; states["Length"]]]];
In[]:=
TagSystemGenerationsCompiled[0,{1,0,1,1,0,0,0,0,1,1,1}]
Out[]=
9
In[]:=
AllInits/@Range[3]
Out[]=
{{{0,{0}},{0,{1}},{1,{0}},{1,{1}},{2,{0}},{2,{1}}},{{0,{0,0}},{0,{0,1}},{0,{1,0}},{0,{1,1}},{1,{0,0}},{1,{0,1}},{1,{1,0}},{1,{1,1}},{2,{0,0}},{2,{0,1}},{2,{1,0}},{2,{1,1}}},{{0,{0,0,0}},{0,{0,0,1}},{0,{0,1,0}},{0,{0,1,1}},{0,{1,0,0}},{0,{1,0,1}},{0,{1,1,0}},{0,{1,1,1}},{1,{0,0,0}},{1,{0,0,1}},{1,{0,1,0}},{1,{0,1,1}},{1,{1,0,0}},{1,{1,0,1}},{1,{1,1,0}},{1,{1,1,1}},{2,{0,0,0}},{2,{0,0,1}},{2,{0,1,0}},{2,{0,1,1}},{2,{1,0,0}},{2,{1,0,1}},{2,{1,1,0}},{2,{1,1,1}}}}
In[]:=
KeySort[Counts[(TagSystemGenerationsCompiled[##]&@@@Catenate[AllInits/@Range[8]])]]
Out[]=
219,345,463,570,6111,7130,8109,9159,10167,11147,1298,1353,1446,1556,1627,1711,188,311,351,3616,3727,3844,3937,4010,498,501,537,551,562,575,619,6213,6317,6411,831