(*This file contains all the possible SA partitions for non-periodic tilings. The other partitions are all excluded by obvious periodicity due to the C-M condition T2. For example, 
{{2,4},{8,16,3,9}} is not listed here because:
due to condition T2, the second tile must be divisible by 
\Phi_8,16,3,9,24,48,72,144 and this is too much, it implies periodicity.
*)

(* Some of SA's here imply more divisibility by \Phi's than required by T2. The reason is that if we fill out T2, then we see that certain further elements must go to one of the components to keep the chance of non-periodicity. E.g. in case of {{3,4,16,12,48},{2,8,9,18,72}}; we see that 144 must come in the second component, and then 36 must go in the first. These are listed here:

{{3,4,9,12,36},{2,8,16}}; 18,72,144,6,24,48;

{{3,8,16,24,48,72},{2,4,9,18,36,144}}; 6,12;

{{3,8,9,24,72},{2,4,16}};6,12,48,18,36,144;

{{3,4,16,12,48,36},{2,8,9,18,72,144}}; 6,24;

{{4,8,9,36,72,144},{2,3,16,6,48,18}};12,24;*)

Dynamic[{j,k}]

n=144;
S={2,4,8,3,6,12,24,9,18,36,72, 16, 48,144};
SAA={2,3,4,8,9,16};

PS=Subsets[S];

PSA=Subsets[SAA];

PA=Array[0&, Length[PSA]];

For[j=1, j≤Length[PSA],
PA[[j]]={PSA[[j]], Complement[SAA, PSA[[j]]]};
j++];






A=Array[0&, 100000];k=1;

For[j=1, j≤Length[PS], H=PS[[j]];d=1;
For[m=1, m≤Length[H], d=LCM[d,H[[m]]];
m++]; 
If[d==n, b=1; G=Complement[S,H];
For[mm=1, mm≤Length[G], b=LCM[b,G[[mm]]]; 
mm++];
If[b==n, 
A[[k]]={H,G};k=k+1]];
 j++];

A=Drop[A⋃{0},1];

Length[A]

MemberQ[A, {{16,144},{2,3,4,6,8,9,12,18,24,36,48,72}}]

TW={2,4,8,16};
TH={3,9};

For[j=1, j≤Length[A], S2=TW⋂A[[j,1]]; S3=TH⋂ A[[j,1]]; SA=Array[0&,{Length[S2],Length[S3]}];
For[x=1,x≤Length[S2], 
For[y=1, y≤Length[S3],
SA[[x,y]]=S2[[x]]S3[[y]];
y++];
x++];
SA=Flatten[SA]; 
If[Not[SA⋂A[[j,1]]==SA⋃{}],A[[j]]=0];
j++];

A=Drop[A⋃{0},1];

MemberQ[A, {{16,144},{2,3,4,6,8,9,12,18,24,36,48,72}}]

Length[A]


For[j=1, j≤Length[A], S2=TW⋂A[[j,2]]; S3=TH⋂ A[[j,2]]; SA=Array[0&,{Length[S2],Length[S3]}];
For[x=1,x≤Length[S2], 
For[y=1, y≤Length[S3],
SA[[x,y]]=S2[[x]]S3[[y]];
y++];
x++];
SA=Flatten[SA]; 
If[Not[SA⋂A[[j,2]]==SA⋃{}],A[[j]]=0];
j++];

A=Drop[A⋃{0},1];

MemberQ[A, {{16,144},{2,3,4,6,8,9,12,18,24,36,48,72}}]

Length[A]


For[j=1,j≤Length[A], A[[j,1]]=A[[j,1]]⋃{}; A[[j,2]]=A[[j,2]]⋃{};
j++];



For[j=1, j≤Length[A], P=A[[j,1]];
For[i=j+1,i≤Length[A], 
If[P==A[[i,2]], A[[j]]=0; i=Length[A]+1];
i++];
j++];


A=Drop[A⋃{0},1];

Length[A]
A;

For[j=1, j≤Length[A], A[[j,1]]=A[[j,1]]⋂SAA; A[[j,2]]=A[[j,2]]⋂SAA; 
j++];
A=Drop[A⋃{0},1];

Length[A]
A;

For[j=1, j≤Length[A], M={A[[j,2]],A[[j,1]]};
If[MemberQ[A, M], A[[j]]=0];
j++];
A=Drop[A⋃{0},1];

Length[A]
A

PB=Array[0&, 2Length[A]];

For[j=1, j≤Length[A],
PB[[2j-1]]=A[[j]]; PB[[2j]]={A[[j,2]],A[[j,1]]};
j++];

PP=Complement[PA, PB]



(*{{3,4,8},{2,9,16}}; 60;6;162;12; jo;OK;
{{3,4,9},{2,8,16}}; 0;jo; Doc;
{{3,4,16},{2,8,9}}; 0; jo; Doc;
{{3,8,9},{2,4,16}}; 0; jo; Doc;
{{3,8,16},{2,4,9}}; 0; jo; Doc;
{{4,8,9},{2,3,16}}; 0; jo; Doc;
{{4,8,16},{2,3,9}}; 0; bytheory; Doc;
{{4,9,16},{2,3,8}}; 324;6; jo;OK;
{{8,9,16},{2,3,4}}; 0; jo;OK;
{{2,3,4,8},{9,16}}; 0; jo;OK;
{{2,3,4,16},{8,9}}; 0; jo;
{{2,3,8,9},{4,16}}; 0; jo;
{{2,3,8,16},{4,9}}; 0; jo;
{{2,4,8,16},{3,9}}; 0; bytheoryandnumerics;
{{2,4,9,16},{3,8}}; 8640; 3; jo;OK;
{{2,8,9,16},{3,4}}; 36;6; jo; OK;
{{3,4,8,16},{2,9}}; 0; jo;
{{4,8,9,16},{2,3}}; 0; jo;OK;
{{2,3,4,8,16},{9}}; 0; jo;
*)

(* The excluded cases are listed here. They all trivially make one of the tiles periodic, except in the case {{2,4,8,9},{3,16}} which is slightly tricky. In that case the point is that whereever 144 comes, that part will be periodic. E.g. if it goes to {3,16}, then notice that 48 is also there by condition T2, so we have {3,16, 48, 144} which is periodic! *)