Arithmetic Function CAs
Arithmetic Function CAs
In[]:=
terms=Times@@@Subsets[Slot/@Range[3]];
In[]:=
f2s=Sort[Total/@Subsets[terms]];
In[]:=
c2Codes=Function[{fun},FromDigits[Apply[Evaluate[Mod[fun,2]]&,Tuples[{1,0},3],{1}],2]]/@f2s;
In[]:=
Length@c2CodesComplement[Range[255],c2Codes]
Out[]=
256
Out[]=
{}
In[]:=
f3s=Union[(Total/@Subsets[Join[terms,2terms]])/.{3->0}/.Slot[0]->Slot[3]];
In[]:=
RandomSample[f3s,5]//TableForm
Out[]//TableForm=
2+2#1+#1#2+2#2#3+2#1#2#3 |
2#1+2#1#3+#2#3+#1#2#3 |
1+#1+2#2+2#1#2+#1#3 |
1+2#1+#2+2#1#2+#3+2#2#3 |
2+2#3+#1#3 |
In[]:=
AbsoluteTiming[c3Codes=Function[{fun},FromDigits[Apply[Mod[Evaluate[fun],3]&,Tuples[{2,1,0},3],{1}],3]]/@f3s];
In[]:=
Length[c3Codes]
Out[]=
6561
In[]:=
ResourceFunction["InteractiveListSelector"][ArrayPlot[CellularAutomaton[{#,3},SeedRandom[24142];RandomInteger[2,200],150],Frame->False,ColorRules->{0->White,1->Blue,2->Red},PixelConstrained1]->#&/@RandomSample[c3Codes,100]]
Out[]=