/* Finding yellow words at distance 7 from the identity. These words all agree with Identity on positions 8,9,10,11,12. Note that the (5^7 = 78125) words with |w| = 5 are ignored. This program does check (implicitly) that the final words found are yellow. */ G:=PermutationGroup<12|(1,2,3,4,5,6,7,8,9,10,11),(3,4)(2,10)(6,7)(5,9),(11,12)(1,10)(2,5)(3,7)(4,8)(6,9)>; M12:=G; // G = M12. B:=Base(G); // Not used below. hamdist:=func; // Not used either. SSC:=[]; S5:=[[1..12],[1..12],[1..12],[1..12],[1..12],[1..12],[1..12],[8],[9],[10],[11],[12]]; for i in [1..7] do S5[i]:=[u:u in S5[i]|u ne i];end for; SS5:=[S5]; SS6:=[]; for i in [1..7] do for j in [u:u in S5[i]|u le 7] do ss:=S5;ss[i]:=[j];Append(~SS6,ss);end for;end for; // {{#u:u in ss}:ss in SS6}; OSS:=SS6;SS6:=[]; for uu in OSS do pp:=[i:i in [1..12]|#uu[i] eq 1];npp:=#pp;ss:=uu; for i1 in [1..npp],i2 in [i1+1..npp],i3 in [i2+1..npp],i4 in [i3+1..npp],i5 in [i4+1..npp] do ps:=[pp[u]:u in [i1,i2,i3,i4,i5]];bb,pe:=IsConjugate(M12,ps,[ss[u][1]:u in ps]);spe:=Eltseq(pe); for j in [u:u in [1..12]|u notin ps] do ss[j]:=[u:u in ss[j]|u ne spe[j]];end for; end for;Append(~SS6,ss);end for; OSS:=SS6;SS6:=[]; for uu in OSS do pp:=[i:i in [1..12]|#uu[i] eq 1];npp:=#pp;ss:=uu; for i1 in [1..npp],i2 in [i1+1..npp],i3 in [i2+1..npp],i4 in [i3+1..npp],i5 in [i4+1..npp] do ps:=[pp[u]:u in [i1,i2,i3,i4,i5]];bb,pe:=IsConjugate(M12,ps,[ss[u][1]:u in ps]);spe:=Eltseq(pe); for j in [u:u in [1..12]|u notin ps] do ss[j]:=[u:u in ss[j]|u ne spe[j]];end for; end for;Append(~SS6,ss);end for; {{#u:u in ss}:ss in SS6}; OSS eq SS6; ""; NSS:=[]; for ss in SS6 do if {#u:u in ss} eq {1} then Append(~NSS,ss); elif 0 notin {#u:u in ss} then j:=Min({i:i in [1..12]|#ss[i] ne 1}); for k in ss[j] do uu:=ss;uu[j]:=[k];Append(~NSS,uu);end for; end if;end for; print #NSS; // SS7:=NSS; cou:=0;OSS:=[]; while OSS ne NSS do OSS:=NSS;NSS:=[]; for uu in OSS do pp:=[i:i in [1..12]|#uu[i] eq 1];npp:=#pp;ss:=uu; for i1 in [1..npp],i2 in [i1+1..npp],i3 in [i2+1..npp],i4 in [i3+1..npp],i5 in [i4+1..npp] do ps:=[pp[u]:u in [i1,i2,i3,i4,i5]];bb,pe:=IsConjugate(M12,ps,[ss[u][1]:u in ps]); if bb then spe:=Eltseq(pe); for j in [u:u in [1..12]|u notin ps] do ss[j]:=[u:u in ss[j]|u ne spe[j]];end for;end if; end for;Append(~NSS,ss);end for; NSS:=[ss:ss in NSS|0 notin {#u:u in ss}]; cou+:=1;cou,"\t",#OSS,"\t",#NSS;//,"\t",{{#u:u in ss}:ss in NSS};; end while; SS7:=Setseq(Set(NSS));#NSS,"\t",#SS7; {{#u:u in ss}:ss in SS7}; SSC:=SSC cat [ss:ss in SS7|{#u:u in ss} eq {1}]; SS7:=[ss:ss in SS7|{#u:u in ss} ne {1}]; SSC:=Setseq(Set(SSC)); #SSC,"\t",#SS7; // OSS eq SS7; ""; NSS:=[]; for ss in SS7 do if {#u:u in ss} eq {1} then Append(~NSS,ss); elif 0 notin {#u:u in ss} then j:=Min({i:i in [1..12]|#ss[i] ne 1}); for k in ss[j] do uu:=ss;uu[j]:=[k];Append(~NSS,uu);end for; end if;end for; print #NSS; // SS8:=NSS; cou:=0;OSS:=[]; while OSS ne NSS do OSS:=NSS;NSS:=[]; for uu in OSS do pp:=[i:i in [1..12]|#uu[i] eq 1];npp:=#pp;ss:=uu; for i1 in [1..npp],i2 in [i1+1..npp],i3 in [i2+1..npp],i4 in [i3+1..npp],i5 in [i4+1..npp] do ps:=[pp[u]:u in [i1,i2,i3,i4,i5]];bb,pe:=IsConjugate(M12,ps,[ss[u][1]:u in ps]); if bb then spe:=Eltseq(pe); for j in [u:u in [1..12]|u notin ps] do ss[j]:=[u:u in ss[j]|u ne spe[j]];end for;end if; end for;Append(~NSS,ss);end for; NSS:=[ss:ss in NSS|0 notin {#u:u in ss}]; cou+:=1;cou,"\t",#OSS,"\t",#NSS;//,"\t",{{#u:u in ss}:ss in NSS};; end while; SS8:=Setseq(Set(NSS));#NSS,"\t",#SS8; {{#u:u in ss}:ss in SS8}; SSC:=SSC cat [ss:ss in SS8|{#u:u in ss} eq {1}]; SS8:=[ss:ss in SS8|{#u:u in ss} ne {1}]; SSC:=Setseq(Set(SSC)); #SSC,"\t",#SS8; ""; NSS:=[]; for ss in SS8 do if {#u:u in ss} eq {1} then Append(~NSS,ss); elif 0 notin {#u:u in ss} then j:=Min({i:i in [1..12]|#ss[i] ne 1}); for k in ss[j] do uu:=ss;uu[j]:=[k];Append(~NSS,uu);end for; end if;end for; print #NSS; // SS9:=NSS; cou:=0;OSS:=[]; while OSS ne NSS do OSS:=NSS;NSS:=[]; for uu in OSS do pp:=[i:i in [1..12]|#uu[i] eq 1];npp:=#pp;ss:=uu; for i1 in [1..npp],i2 in [i1+1..npp],i3 in [i2+1..npp],i4 in [i3+1..npp],i5 in [i4+1..npp] do ps:=[pp[u]:u in [i1,i2,i3,i4,i5]];bb,pe:=IsConjugate(M12,ps,[ss[u][1]:u in ps]); if bb then spe:=Eltseq(pe); for j in [u:u in [1..12]|u notin ps] do ss[j]:=[u:u in ss[j]|u ne spe[j]];end for;end if; end for;Append(~NSS,ss);end for; NSS:=[ss:ss in NSS|0 notin {#u:u in ss}]; cou+:=1;cou,"\t",#OSS,"\t",#NSS;//,"\t",{{#u:u in ss}:ss in NSS};; end while; SS9:=Setseq(Set(NSS));#NSS,"\t",#SS9; {{#u:u in ss}:ss in SS9}; SSC:=SSC cat [ss:ss in SS9|{#u:u in ss} eq {1}]; SS9:=[ss:ss in SS9|{#u:u in ss} ne {1}]; SSC:=Setseq(Set(SSC)); #SSC,"\t",#SS9; ""; NSS:=[]; for ss in SS9 do if {#u:u in ss} eq {1} then Append(~NSS,ss); elif 0 notin {#u:u in ss} then j:=Min({i:i in [1..12]|#ss[i] ne 1}); for k in ss[j] do uu:=ss;uu[j]:=[k];Append(~NSS,uu);end for; end if;end for; print #NSS; // SS10:=NSS; cou:=0;OSS:=[]; while OSS ne NSS do OSS:=NSS;NSS:=[]; for uu in OSS do pp:=[i:i in [1..12]|#uu[i] eq 1];npp:=#pp;ss:=uu; for i1 in [1..npp],i2 in [i1+1..npp],i3 in [i2+1..npp],i4 in [i3+1..npp],i5 in [i4+1..npp] do ps:=[pp[u]:u in [i1,i2,i3,i4,i5]];bb,pe:=IsConjugate(M12,ps,[ss[u][1]:u in ps]); if bb then spe:=Eltseq(pe); for j in [u:u in [1..12]|u notin ps] do ss[j]:=[u:u in ss[j]|u ne spe[j]];end for;end if; end for;Append(~NSS,ss);end for; NSS:=[ss:ss in NSS|0 notin {#u:u in ss}]; cou+:=1;cou,"\t",#OSS,"\t",#NSS;//,"\t",{{#u:u in ss}:ss in NSS};; end while; SS10:=Setseq(Set(NSS));#NSS,"\t",#SS10; {{#u:u in ss}:ss in SS10}; SSC:=SSC cat [ss:ss in SS10|{#u:u in ss} eq {1}]; SS10:=[ss:ss in SS10|{#u:u in ss} ne {1}]; SSC:=Setseq(Set(SSC)); #SSC,"\t",#SS10; ""; NSS:=[]; for ss in SS10 do if {#u:u in ss} eq {1} then Append(~NSS,ss); elif 0 notin {#u:u in ss} then j:=Min({i:i in [1..12]|#ss[i] ne 1}); for k in ss[j] do uu:=ss;uu[j]:=[k];Append(~NSS,uu);end for; end if;end for; print #NSS; // SS11:=NSS; cou:=0;OSS:=[]; while OSS ne NSS do OSS:=NSS;NSS:=[]; for uu in OSS do pp:=[i:i in [1..12]|#uu[i] eq 1];npp:=#pp;ss:=uu; for i1 in [1..npp],i2 in [i1+1..npp],i3 in [i2+1..npp],i4 in [i3+1..npp],i5 in [i4+1..npp] do ps:=[pp[u]:u in [i1,i2,i3,i4,i5]];bb,pe:=IsConjugate(M12,ps,[ss[u][1]:u in ps]); if bb then spe:=Eltseq(pe); for j in [u:u in [1..12]|u notin ps] do ss[j]:=[u:u in ss[j]|u ne spe[j]];end for;end if; end for;Append(~NSS,ss);end for; NSS:=[ss:ss in NSS|0 notin {#u:u in ss}]; cou+:=1;cou,"\t",#OSS,"\t",#NSS;//,"\t",{{#u:u in ss}:ss in NSS};; end while; SS11:=Setseq(Set(NSS));#NSS,"\t",#SS11; {{#u:u in ss}:ss in SS11}; SSC:=SSC cat [ss:ss in SS11|{#u:u in ss} eq {1}]; SS11:=[ss:ss in SS11|{#u:u in ss} ne {1}]; SSC:=Setseq(Set(SSC)); #SSC,"\t",#SS11; ""; NSS:=[]; for ss in SS11 do if {#u:u in ss} eq {1} then Append(~NSS,ss); elif 0 notin {#u:u in ss} then j:=Min({i:i in [1..12]|#ss[i] ne 1}); for k in ss[j] do uu:=ss;uu[j]:=[k];Append(~NSS,uu);end for; end if;end for; print #NSS; // SS12:=NSS; cou:=0;OSS:=[]; while OSS ne NSS do OSS:=NSS;NSS:=[]; for uu in OSS do pp:=[i:i in [1..12]|#uu[i] eq 1];npp:=#pp;ss:=uu; for i1 in [1..npp],i2 in [i1+1..npp],i3 in [i2+1..npp],i4 in [i3+1..npp],i5 in [i4+1..npp] do ps:=[pp[u]:u in [i1,i2,i3,i4,i5]];bb,pe:=IsConjugate(M12,ps,[ss[u][1]:u in ps]); if bb then spe:=Eltseq(pe); for j in [u:u in [1..12]|u notin ps] do ss[j]:=[u:u in ss[j]|u ne spe[j]];end for;end if; end for;Append(~NSS,ss);end for; NSS:=[ss:ss in NSS|0 notin {#u:u in ss}]; cou+:=1;cou,"\t",#OSS,"\t",#NSS;//,"\t",{{#u:u in ss}:ss in NSS};; end while; SS12:=Setseq(Set(NSS));#NSS,"\t",#SS12; {{#u:u in ss}:ss in SS12}; SSC:=SSC cat [ss:ss in SS12|{#u:u in ss} eq {1}]; SS12:=[ss:ss in SS12|{#u:u in ss} ne {1}]; SSC:=Setseq(Set(SSC)); #SSC,"\t",#SS12; SS:=[[u[1]:u in ss]:ss in SSC]; Sort(~SS); #SS,"\t",#Set(SS); // The (interesting) yellow words are of course in SS.