login
A266380
Decimal representation of the n-th iteration of the "Rule 21" elementary cellular automaton starting with a single ON (black) cell.
4
1, 3, 0, 127, 0, 2047, 0, 32767, 0, 524287, 0, 8388607, 0, 134217727, 0, 2147483647, 0, 34359738367, 0, 549755813887, 0, 8796093022207, 0, 140737488355327, 0, 2251799813685247, 0, 36028797018963967, 0, 576460752303423487, 0, 9223372036854775807, 0
OFFSET
0,2
REFERENCES
S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 55.
FORMULA
From Colin Barker, Dec 29 2015 and Apr 15 2019: (Start)
a(n) = 17*a(n-2) - 16*a(n-4) for n>5.
G.f.: (1 + 3*x - 17*x^2 + 76*x^3 + 16*x^4 - 64*x^5) / ((1-x)*(1+x)*(1-4*x)*(1+4*x)). (End)
a(n) = (1 - (-1)^n)*(4*16^floor(n/2) - 1/2) for n>1. - Bruno Berselli, Dec 29 2015
a(n) = (2*4^n - 1)*(n mod 2) + 0^n - 4*0^abs(n-1). - Karl V. Keller, Jr., Sep 03 2021
MATHEMATICA
rule=21; rows=20; ca=CellularAutomaton[rule, {{1}, 0}, rows-1, {All, All}]; (* Start with single black cell *) catri=Table[Take[ca[[k]], {rows-k+1, rows+k-1}], {k, 1, rows}]; (* Truncated list of each row *) Table[FromDigits[catri[[k]], 2], {k, 1, rows}] (* Decimal Representation of Rows *)
PROG
(Magma) [n le 1 select 3^n else (1-(-1)^n)*(4*16^Floor(n/2)-1/2): n in [0..40]]; // Bruno Berselli, Dec 29 2015
(Python) print([(2*4**n - 1)*(n%2) + 0**n - 4*0**abs(n-1) for n in range(50)]) # Karl V. Keller, Jr., Sep 03 2021
CROSSREFS
Cf. A241955: a(2*n+1) for n>0.
Sequence in context: A322458 A370712 A372314 * A076951 A359561 A060282
KEYWORD
nonn,easy
AUTHOR
Robert Price, Dec 28 2015
STATUS
approved