
MATHEMATICA

CAStep[rule_, a_]:=Map[rule[[10#]]&, ListConvolve[{{0, 2, 0}, {2, 1, 2}, {0, 2, 0}}, a, 2], {2}];
code=429; stages=128;
rule=IntegerDigits[code, 2, 10];
g=2*stages+1; (* Maximum size of grid *)
a=PadLeft[{{1}}, {g, g}, 0, Floor[{g, g}/2]]; (* Initial ON cell on grid *)
ca=a;
ca=Table[ca=CAStep[rule, ca], {n, 1, stages+1}];
PrependTo[ca, a];
(* Trim full grid to reflect growth by one cell at each stage *)
k=(Length[ca[[1]]]+1)/2;
ca=Table[Table[Part[ca[[n]][[j]], Range[k+1n, k1+n]], {j, k+1n, k1+n}], {n, 1, k}];
on=Map[Function[Apply[Plus, Flatten[#1]]], ca] (* Count ON cells at each stage *)
Part[on, 2^Range[0, Log[2, stages]]] (* Extract relevant terms *)
