In answering this question we refer to the algorithm at the MSE
link which works
for the generalized problem as well. The only difference is that the
values that go into the slots of the array/table are pairs of states
and output symbols, meaning when we transition from a certain column
on an input symbol corresponding to a row we transition to the state
(first element of the pair) and output the symbol (second element of
the pair). The action on the slots is the simultaneous action of $\pi$
and $\tau$ on the rows and columns and we now have a permutation
$\sigma$ which acts on the set of output symbols and the action on the
values is the combined action of $\tau$ and $\sigma$ on the state /
symbol pairs.
We get the following table for one output symbol.
| 1| 1| 1| 1| 1| 1| 1| 1|
| 3| 7| 13| 22| 34| 50| 70| 95|
| 7| 74| 638| 4663| 28529| 151600| 713176| 3028727|
| 19| 1474| 118949| 7643021| 396979499| 17265522590| 646203233957| 21243806443115|
| 47| 41876| 42483668| 33179970333| 20762461502595| 10831034126757463| 4844565331763027596| 1896647286212566394157|
| 130| 1540696| 23524514635| 274252613077267| 2559276179593762172| 19903050866658120066632| 132673733865643566661223817| 773869304738817313660236854435|
| 343| 68343112| 18477841853059| 3802866637652928476| 626361440405926396941497| 85973094952794304259466151418| 10114722264843500593900485682759058| 1041247439945746392774732251877428013424|
| 951| 3540691525| 19526400231564564| 81874932562648494674439| 274724907231470170012527305235| 768186632385442429091738459545921683| 1841148232300929744056375072663778725072045| 3861169308385212945415179151162048048461447621051|
For two output symbols we have
| 1| 2| 2| 3| 3| 4| 4| 5|
| 6| 44| 226| 1036| 4006| 13876| 43186| 123706|
| 22| 2038| 142336| 7775708| 341906882| 12592855970| 399366367444| 11132314379998|
| 114| 176936| 238882846| 244698934716| 200649261017386| 137143648460408272| 80366174079209158078| 41217801421317353953038|
| 538| 20943790| 694540531869| 17362195783419565| 347256965617453111707| 5787905149678353796143590| 82689320232608432438262174088| 1033688856029644143398545746261666|
| 2800| 3108818680| 3081614657394158| 2300263170022800838590| 1373710145403734491538076692| 683647218221456315461840833799588| 291623393789554111334921119339297251576| 108848103655093534827120896470552784018126133|
| 14435| 553255960308| 19368605578168164179| 510403370619400317035233276| 10760675018954199971112474584547034| 189053417206572805331242303827478007687534| 2846969183281612697167894035560332610102537605107| 37513627164757945129191686915360296965220882487348368322|
| 76312| 114776687721990| 163754994767359896315206| 175823884588034784365611422263567| 151031502945525188132621372232074129315388| 108112560585492844973667875651850996929528575835574| 66334273232261168899346826889209523621370385072001650536116| 35612941825082950044316879351953518880328546726186269125209259942000|
Three output symbols yield
| 1| 2| 3| 4| 5| 7| 8| 10|
| 6| 74| 775| 7124| 55668| 377269| 2255068| 12102178|
| 29| 7623| 1804128| 329641077| 48317584819| 5910777204447| 620630699132987| 57098016161377374|
| 190| 1501516| 10322146155| 53512221536494| 221968136483832014| 767306804276224740828| 2273639672252875423729778| 5895263464882668948056075498|
| 1289| 401371270| 101367856946674| 19243544529701850104| 2922627429145967591227933| 369897467120287921148106491100| 40127586921742103692252419866530400| 3809020901470314640315364328599642887506|
| 9673| 134138227473| 1518024410618449355| 12907594258334064169919121| 87803188849193004851359368791756| 497730359833453928180319002991414602093| 2418417068028280199534213597754694851805840225| 10281969996512134071147543063509604282591387558257520|
| 73604| 53725010241266| 32201676604966459555889| 14499308203534486200843433873288| 5222906915046943511008193569385565417541| 1567819635143439097415728431946215896270059293161| 403397426941463986598664115278880491308873007636372427413| 90819310744609116970288225981171645606992548661728301980002516662|
| 573442| 25081227120200634| 918865057207831149035535828| 25285803348327743049043999665003927370| 556668502782671968664754976635618690023788914186| 10212576716712592462402577334011641314012112279662417473469| 160593227242102911238351158110065456181421151497935704882980552606514| 2209668743041973325985756217800328983151637526070225333484395817216844313778044|
Four symbols yield
| 1| 2| 3| 5| 6| 9| 11| 15|
| 6| 81| 1183| 17320| 223743| 2527953| 25100642| 222144431|
| 29| 11676| 6064606| 2593640209| 897009602752| 259029607981273| 64163314527895517| 13915354324987224434|
| 209| 3831148| 81573276196| 1334647986999812| 17493019379544106141| 191083931326433751661244| 1789145512052234025354299479| 14658245204843197745963032946030|
| 1605| 1790644262| 1896670209705424| 1517048789183286280242| 970906913413864886205472630| 517817738821504564293534451239523| 236717123156531446119639354041331039161| 94687056373953999303903668799913187496263156|
| 14581| 1059379897194| 67316410303471722434| 3215992447007150335848738654| 122917096383192644964591012637376201| 3914970565374711299589044295533654728633307| 106880364202506644619748019682746095700393900152769| 2553144552899651934745530164746582340956543973128820263056|
| 139393| 753537775187942| 3384772964731425916075399| 11417522742490309099171117430032545| 30811161705715253062014503052903675566658545| 69288800372821565423720577304077855202305583626701885| 133558404360787903168869516536280931557107488047811301767090944| 225261750393971075099732774525570356293879964632402213718679044305894097|
| 1396571| 625251791124395555| 228938436067723951049495991006| 62929794221715160999635636523327894882612| 13838407708142508413727196626725814975774777251143465| 2535915030456565177161444959970701001632828430350354446662490458| 398324009007397248996962807526047717969141597988514641606768498289421689877| 54745234941096457415294245370001308972451724232455240696557887565208148810995582605398|
Five yield
| 1| 2| 3| 5| 7| 10| 13| 18|
| 6| 81| 1283| 23718| 427097| 7038183| 103821898| 1372476565|
| 29| 12621| 9875766| 7694431189| 5108729338005| 2866744631627614| 1383444387175373624| 584738631310521555854|
| 209| 5269634| 242293771832| 9508729532667775| 303537782294910006324| 8092008307288214998320242| 184959457244832433282602143175| 3699331066099122391214267900044654|
| 1652| 3522483774| 10830193709142911| 26326043763404282897041| 51400728418762283743166947873| 83657888529920202329649049898106090| 116710057646947398301738658574346204631684| 142468411615177769332030145694979476640229799189|
| 15851| 3145805694347| 748102205731495912974| 136208975222504119847429651282| 19858370962230255015514418124978318079| 2412787002750586428934439397030434799264061139| 251274509502830170033287481345380174207693056359521218| 22897389793260955643229220128574252798224672181928261140465132|
| 166704| 3451400880452119| 73411241836287162439679965| 1180551376563438246848941889675139885| 15191078168438817387019547141066538853359987716| 162897187467367310343607416594982652886027395559664704867| 1497241493787657622590696899117249253525915361372369634716838093562| 12041433120029892610323311791551075975557111745695889862014376128073109032711|
| 1903565| 4453493876743114141| 9696353154834682640039652745383| 15885725788645815939897203091966549890622620| 20821721985157272922019024288021084022442430164588852951| 22742872566990523157952024381064067346859577618809430167348089260678| 21292527088890116346521008056915214793265230093299707297080802600716512185635775| 17442838191172723332310678848004599133452884005515399679140805741625547114446168989072880538|
Finally we get for six symbols
| 1| 2| 3| 5| 7| 11| 14| 20|
| 6| 81| 1296| 25462| 538398| 11293138| 222523395| 4028465835|
| 29| 12695| 11328242| 12588216476| 13507531099557| 12816676023294742| 10610435880654869474| 7727294095780485593467|
| 209| 5635034| 396518228841| 29902254119865429| 1947536351902062154396| 107300432454566001311927042| 5082116300041019725568491696927| 210740137620013511032529954013222997|
| 1652| 4452248665| 28661573376513712| 168916250895768873373125| 817701868164546859278494745163| 3309982213851389919369842502624515185| 11489588802579132510260340618793545674029229| 34899323818332948931809633587657800749959429140381|
| 15981| 5147747713851| 3350282292788028229116| 1806224092274722460193800299488| 785710893213334594665452752490935409600| 285033249600409431428643990739291312182972084132| 88635922473731155883430561365483225722614035385062387241| 24117625609927898779221726509298149056270088412428821435055351917|
| 171494| 7721337186134447| 564461055370558962491069562| 32440112974696247296439224174402635608| 1495496356773389913366753876131348301821086183629| 57461231472727120738649283370058285613319924784137652332510| 1892438067444572851650149500498661434054764424790064535313952779756847| 54535174475104423211660022224834911399436311980199332329136348183225443895408945|
| 2041940| 14003166710753529537| 128580139323392617149472430498611| 905045555050578843422814928359489284108944076| 5100536012710000997786910449314715054126988193344281363091| 23954874543703392448557828429937283387539096055257084732285733625757877| 96433013296267950226465899688337115485213562485757881838921103460239405763926814829| 339676614862729029614552301296020122485910436927008569295805654935518977116532247635480871741432|
The Maple code for this was as follows.
with(combinat);
pet_cycleind_symm :=
proc(n)
local p, s;
option remember;
if n=0 then return 1; fi;
expand(1/n*add(a[l]*pet_cycleind_symm(n-l), l=1..n));
end;
pet_flatten_term :=
proc(varp)
local terml, d, cf, v;
terml := [];
cf := varp;
for v in indets(varp) do
d := degree(varp, v);
terml := [op(terml), seq(v, k=1..d)];
cf := cf/v^d;
od;
[cf, terml];
end;
cycles_prod :=
proc(cyca, cycb)
local ca, cb, lena, lenb, res, vlcm;
res := 1;
for ca in cyca do
lena := op(1, ca);
for cb in cycb do
lenb := op(1, cb);
vlcm := lcm(lena, lenb);
res := res*a[vlcm]^(lena*lenb/vlcm);
od;
od;
res;
end;
automaton :=
proc(N, M, K)
option remember;
local idx_slots, idx_cols, idx_syms, res, a, b, c, sim, flat_sim,
sym, flat_sym, flat_a, flat_b, flat_c,
cyc_a, cyc_b, len_a, len_b, p, q;
if N > 1 then
idx_slots := pet_cycleind_symm(N);
else
idx_slots := [a[1]];
fi;
if M > 1 then
idx_cols := pet_cycleind_symm(M);
else
idx_cols := [a[1]];
fi;
if K > 1 then
idx_syms := pet_cycleind_symm(K);
else
idx_syms := [a[1]];
fi;
res := 0;
for a in idx_slots do
flat_a := pet_flatten_term(a);
for b in idx_cols do
flat_b := pet_flatten_term(b);
sim := cycles_prod(flat_a[2], flat_b[2]);
flat_sim := pet_flatten_term(sim);
for c in idx_syms do
flat_c := pet_flatten_term(c);
sym := cycles_prod(flat_b[2], flat_c[2]);
flat_sym := pet_flatten_term(sym);
p := 1;
for cyc_a in flat_sim[2] do
len_a := op(1, cyc_a);
q := 0;
for cyc_b in flat_sym[2] do
len_b := op(1, cyc_b);
if len_a mod len_b = 0 then
q := q + len_b;
fi;
od;
p := p*q;
od;
res := res +
p*flat_a[1]*flat_b[1]*flat_c[1];
od;
od;
od;
res;
end;
output :=
proc(MXN, MXM, K)
local data, N, M, fd, fname, width;
data := table();
for N to MXN do
data[N] := table();
for M to MXM do
data[N][M] := automaton(M, N, K);
od;
od;
fname := sprintf("automata-%d-%d-%d.txt", MXN, MXM, K);
fd := fopen(fname, WRITE);
for N to MXN do
fprintf(fd, "|");
for M to MXM do
width := nops(convert(data[MXN][M], base, 10));
fprintf(fd, "% *d|", width+1, data[N][M]);
od;
fprintf(fd, "\n");
od;
fclose(fd);
end;