(*{{2,3,4,16},{8,9}};*)

Dynamic[{j,i,g, mark}]
Clear[n,B,R,Tile,A,U,mark,T,g,x];

L=Expand[Cyclotomic[2,x^(9)]Cyclotomic[4,x^9]Cyclotomic[3,x^(8)]];

n=72;

B=Array[0&,Length[L]];
For[j=2, j≤Length[L], B[[j]]=Mod[L[[j,2]],n];
j++];
B⋃{}



(*{{2,3,4,16},{8,9}};*)

Dynamic[{j,i,g, mark}]
Clear[n,B,R,Tile,A,U,mark,T,g,x];

n=72;


B={0,8,9,16,17,18,25,26,27,34,35,43}
Length[B];

Tile=Array[0&,1000000];
R=Array[0&,n];
A=Array[200&,{n/Length[B],n,Length[B]}];
U=Array[0&,n/Length[B]];
U[[1]]=B;
mark=Array[1&,n/Length[B]+1];
T=Array[{0}&,n/Length[B]];
g=1;

For[i=1, i>0,
If[Length[U[[i]]]==n,  Tile[[g]]=T[[i]]⋃{};g=g+1;T[[i]]=T[[i-1]];mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];i=i-1,
For[j=1, j≤n,k=100;
If[Not[MemberQ[U[[i]],Mod[j,n]]], k=0;
For[m=1, m≤Length[B],
If[U[[i]]⋂ Mod[(j-B[[m]])+B,n]=={}, k=k+1; A[[i,j,m]]=Mod[j-B[[m]],n]];
m++]];
R[[j]]=k;
j++];
min=Min[R]; 
If[(Not[min==0]),
t=Catch[Do[If[R[[ii]]==min, Throw[ii]],{ii,n}]];
If[mark[[i]]≤Length[B],
For[b=mark[[i]], b<=Length[B],mark[[i]]=b+1;z=0;
If[Not[A[[i,t,b]]==200], U[[i+1]]=U[[i]]⋃Mod[A[[i,t,b]]+B,n]; T[[i+1]]=T[[i]]⋃{A[[i,t,b]]}; b=Length[B]+1;z=1;i=i+1;];
b++];
If[z==0, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];i=i-1];
, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];T[[i]]=T[[i-1]];i=i-1];
, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];T[[i]]=T[[i-1]];i=i-1];
];
];

Tile=Drop[Tile⋃{},1];
Length[Tile]
Tile;

H=Array[{0}&,Length[Tile[[1]]]+1];
K=Tile[[3]];
For[j=1, j≤Length[K], 
H[[j+1]]=Mod[(K[[j]]+B)⋃ H[[j]],n];
j++];
H[[Length[K]+1]]⋃{} 

For[j=1, j≤Length[Tile], P=Tile[[j]];
For[i=2, i<=Length[P], 
If[MemberQ[Tile,Mod[P-P[[i]],n]⋃{}], Tile[[j]]=0;i=Length[P]+1];
i++];
j++]; 
Tile=Drop[Tile⋃{},1];
Length[Tile]
Tile;

(*So we have all tiles modulo 72. Now we sholuld shift the elements by multiples of 72, to get all tiles mod 144. But instead i shift the whole set B below, and run the fill-out for n=144. It is the same. *)

(*{{2,3,4,16},{8,9}};*)

Dynamic[{j,i,g, mark}]
Clear[n,B,R,Tile,A,U,mark,T,g,x];

n=144;


B={0,8,9,16,17,18,25,26,27,34,35,43}
B=B⋃(72+B)
Length[B];

Tile=Array[0&,1000000];
R=Array[0&,n];
A=Array[200&,{n/Length[B],n,Length[B]}];
U=Array[0&,n/Length[B]];
U[[1]]=B;
mark=Array[1&,n/Length[B]+1];
T=Array[{0}&,n/Length[B]];
g=1;

For[i=1, i>0,
If[Length[U[[i]]]==n,  Tile[[g]]=T[[i]]⋃{};g=g+1;T[[i]]=T[[i-1]];mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];i=i-1,
For[j=1, j≤n,k=100;
If[Not[MemberQ[U[[i]],Mod[j,n]]], k=0;
For[m=1, m≤Length[B],
If[U[[i]]⋂ Mod[(j-B[[m]])+B,n]=={}, k=k+1; A[[i,j,m]]=Mod[j-B[[m]],n]];
m++]];
R[[j]]=k;
j++];
min=Min[R]; 
If[(Not[min==0]),
t=Catch[Do[If[R[[ii]]==min, Throw[ii]],{ii,n}]];
If[mark[[i]]≤Length[B],
For[b=mark[[i]], b<=Length[B],mark[[i]]=b+1;z=0;
If[Not[A[[i,t,b]]==200], U[[i+1]]=U[[i]]⋃Mod[A[[i,t,b]]+B,n]; T[[i+1]]=T[[i]]⋃{A[[i,t,b]]}; b=Length[B]+1;z=1;i=i+1;];
b++];
If[z==0, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];i=i-1];
, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];T[[i]]=T[[i-1]];i=i-1];
, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];T[[i]]=T[[i-1]];i=i-1];
];
];

Tile=Drop[Tile⋃{},1];
Length[Tile]
Tile;

H=Array[{0}&,Length[Tile[[1]]]+1];
K=Tile[[3]];
For[j=1, j≤Length[K], 
H[[j+1]]=Mod[(K[[j]]+B)⋃ H[[j]],n];
j++];
H[[Length[K]+1]]⋃{} 

For[j=1, j≤Length[Tile], P=Tile[[j]];
For[i=2, i<=Length[P], 
If[MemberQ[Tile,Mod[P-P[[i]],n]⋃{}], Tile[[j]]=0;i=Length[P]+1];
i++];
j++]; 
Tile=Drop[Tile⋃{},1];
Length[Tile]
Tile

(*{{2,3,4,16},{8,9}};*)

(* There remains 95 tiles. I don't even select them into Fourier-zero classes but run the maxperiod procedure at once for all of them. *)

Dynamic[{jj,j,i,g, mark, rr}]
Clear[n,J,B,R,Tile,A,U,mark,T,g,x];

n=144;

J={{0,28,52,76,96,120},{0,36,42,75,78,111},{0,36,48,78,84,114},{0,36,51,75,87,111},{0,36,51,84,87,120},{0,36,51,87,102,138},{0,36,57,78,93,114},{0,36,57,87,93,123},{0,36,57,93,96,132},{0,36,57,93,105,141},{0,36,60,75,96,111},{0,36,60,84,96,120},{0,36,60,93,96,129},{0,36,60,96,102,138},{0,36,66,78,102,114},{0,36,66,87,102,123},{0,36,66,96,102,132},{0,36,66,102,105,141},{0,36,69,75,105,111},{0,36,69,84,105,120},{0,36,69,93,105,129},{0,36,69,102,105,138},{0,39,42,75,78,108},{0,39,51,75,87,108},{0,39,60,75,96,108},{0,39,69,75,105,108},{0,39,75,78,108,114},{0,39,75,87,108,123},{0,39,75,96,108,132},{0,39,75,105,108,141},{0,42,48,78,84,108},{0,42,57,78,93,108},{0,42,66,78,102,108},{0,42,75,78,108,111},{0,42,78,84,108,120},{0,42,78,93,108,129},{0,42,78,102,108,138},{0,44,68,92,96,120},{0,48,51,84,87,108},{0,48,52,76,96,100},{0,48,60,84,96,108},{0,48,68,92,96,116},{0,48,69,84,105,108},{0,48,76,96,100,124},{0,48,78,84,108,114},{0,48,84,87,108,123},{0,48,84,96,108,132},{0,48,84,105,108,141},{0,48,92,96,116,140},{0,51,57,87,93,108},{0,51,66,87,102,108},{0,51,75,87,108,111},{0,51,84,87,108,120},{0,51,87,93,108,129},{0,51,87,102,108,138},{0,52,76,96,100,120},{0,57,60,93,96,108},{0,57,69,93,105,108},{0,57,78,93,108,114},{0,57,87,93,108,123},{0,57,93,96,108,132},{0,57,93,105,108,141},{0,60,66,96,102,108},{0,60,75,96,108,111},{0,60,84,96,108,120},{0,60,93,96,108,129},{0,60,96,102,108,138},{0,66,69,102,105,108},{0,66,78,102,108,114},{0,66,87,102,108,123},{0,66,96,102,108,132},{0,66,102,105,108,141},{0,68,92,96,116,120},{0,69,75,105,108,111},{0,69,84,105,108,120},{0,69,93,105,108,129},{0,69,102,105,108,138},{0,75,78,108,111,114},{0,75,87,108,111,123},{0,75,96,108,111,132},{0,75,105,108,111,141},{0,76,96,100,120,124},{0,78,84,108,114,120},{0,78,93,108,114,129},{0,78,102,108,114,138},{0,84,87,108,120,123},{0,84,96,108,120,132},{0,84,105,108,120,141},{0,87,93,108,123,129},{0,87,102,108,123,138},{0,92,96,116,120,140},{0,93,96,108,129,132},{0,93,105,108,129,141},{0,96,102,108,132,138},{0,102,105,108,138,141}};

rr=1;
gcd=Array[0&,{Length[J],Length[J[[1]]]}];
For[kk=1,kk≤Length[J],
For[mm=2,mm≤Length[J[[kk]]],
gcd[[kk,mm]]=GCD[gcd[[kk,mm-1]],J[[kk,mm]]];
mm++];
kk++];
For[kk=1,kk≤Length[J], gcd[[kk,Length[J[[1]]]]]=GCD[gcd[[kk,Length[J[[1]]]]],n];
kk++];

maxperiod=Array[0&,{Length[J],10000}];

For[jj=1, jj≤Length[J],Clear[B,R,Tile,A,U,mark,T,g,x];n=144;n=n/gcd[[jj, Length[J[[1]]]]];B=J[[jj]]/gcd[[jj,Length[J[[1]]]]];

Tile=Array[0&,100000];
R=Array[0&,n];
A=Array[200&,{n/Length[B],n,Length[B]}];
U=Array[0&,n/Length[B]];
U[[1]]=B;
mark=Array[1&,n/Length[B]+1];
T=Array[{0}&,n/Length[B]];
g=1;

For[i=1, i>0,
If[Length[U[[i]]]==n,  Tile[[g]]=T[[i]]⋃{};maxperiod[[jj,g]]=99;
For[ff=Length[Divisors[n]]-1, ff>0,
If[Mod[((Divisors[n][[ff]])+Tile[[g]]),n]⋃{}==Tile[[g]],Tile[[g]]=0;maxperiod[[jj,g]]=Divisors[n][[ff]];ff=0;
 ];
ff=ff-1];
 g=g+1;T[[i]]=T[[i-1]];mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];i=i-1,
For[j=1, j≤n,k=100;
If[Not[MemberQ[U[[i]],Mod[j,n]]], k=0;
For[m=1, m≤Length[B],
If[U[[i]]⋂ Mod[(j-B[[m]])+B,n]=={}, k=k+1; A[[i,j,m]]=Mod[j-B[[m]],n]];
m++]];
R[[j]]=k;
j++];
min=Min[R]; 
If[(Not[min==0]),
t=Catch[Do[If[R[[ii]]==min, Throw[ii]],{ii,n}]];
If[mark[[i]]≤Length[B],
For[b=mark[[i]], b<=Length[B],mark[[i]]=b+1;z=0;
If[Not[A[[i,t,b]]==200], U[[i+1]]=U[[i]]⋃Mod[A[[i,t,b]]+B,n]; T[[i+1]]=T[[i]]⋃{A[[i,t,b]]}; b=Length[B]+1;z=1;i=i+1;];
b++];
If[z==0, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];i=i-1];
, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];T[[i]]=T[[i-1]];i=i-1];
, mark[[i]]=1;A[[i]]=Array[200&,{n,Length[B]}];T[[i]]=T[[i-1]];i=i-1];
];
];

Tile=Drop[Tile⋃{0},1];
Length[Tile]
Tile;

For[j=1, j≤Length[Tile], P=Tile[[j]];
For[i=2, i<=Length[P], 
If[MemberQ[Tile,Mod[P-P[[i]],n]⋃{}], Tile[[j]]=0;i=Length[P]+1];
i++];
j++]; 
Tile=Drop[Tile⋃{0},1];
If[Not[Length[Tile]==0], rr=rr+1];
Tile;
jj++];
rr

For[j=1,j≤Length[maxperiod],maxperiod[[j]]=Drop[maxperiod[[j]]⋃{0},1];
j++];
maxperiod