# How can I let Mathematica tell me the rule number for Cellular Automata?

I have this Cellular automata and I now how it behaves but I do not know the rule number. Can I let Mathematica give me the number somehow?

seed =Table[RandomInteger[], {200}, {200}]
ArrayPlot[ CellularAutomaton[<|"Dimension" -> 2, "GrowthSurvivalCases" -> {{5,6,7,8}, {4,5,6, 7,8}}|>, seed]]


Edit: I have been reading more up on this and if the elementary CA rules are numbered from 0 to 255, just by the list of 3-neighbor patterns mapping either to 0 or 1. For example take the following:

000 -> 0

001 -> 0

010 -> 1

011 -> 0

100 -> 0

101 -> 1

110 -> 0

111 -> 1

gives rule 2^2+2^5+2^7=4+32+128=164.

Can I do it the same for my 9 neighborhood 2D rule, but now there are 18 different cases 000000000 -> 0

000010000 -> 0

100000000 -> 0

100010000-> 0

110000000 -> 0

110010000-> 0

111000000 -> 0

111010000-> 0

111100000 -> 0

111110000-> 1

111101000 -> 1

111111000-> 1

111101100 -> 1

111111100-> 1

111101110 -> 1

111111110-> 1

111101111 -> 1

111111111-> 1

gives rule 2^9+2^10+2^11+2^12+2^13+2^14+2^15+2^16+2^17= 261632 is the rule number then?

If this is correct I can either write the CA as

ArrayPlot[ CellularAutomaton[<|"OuterTotalisticCode" -> 261632, "Dimension" -> 2, "Neighborhood" -> 9|>,seed, {{{40}}}]]


or this and it is the same, right?

ArrayPlot[ CellularAutomaton[<|"Dimension" -> 2, "GrowthSurvivalCases" -> {{5,6,7,8}, {4,5,6, 7,8}}|>, seed]]

• Apr 29, 2020 at 9:43