OFFSET
0,2
LINKS
Robert Price, Table of n, a(n) for n = 0..999
Eric Weisstein's World of Mathematics, Elementary Cellular Automaton
Eric Weisstein's World of Mathematics, Rule 158
Stephen Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 55.
Index entries for linear recurrences with constant coefficients, signature (2,0,0,1,-2).
FORMULA
From Colin Barker, Dec 07 2015 and Apr 16 2019: (Start)
a(n) = (-45+5*(-1)^n-(6-i*3)*(-i)^n-(6+3*i)*i^n+7*2^(4+n))/60 where i = sqrt(-1).
a(n) = 2*a(n-1)+a(n-4)-2*a(n-5) for n>4.
G.f.: (1+x+x^2) / ((1-x)*(1+x)*(1-2*x)*(1+x^2)).
(End)
a(n) = floor(7*2^(n+2)/15) for n>=0. - Karl V. Keller, Jr., Oct 01 2020
EXAMPLE
From Michael De Vlieger, Dec 09 2015: (Start)
First 8 rows at left, ignoring "0" outside of range of 1's, the center column values in parentheses. The center column values up to that row are concatenated then converted into decimal at right:
Rule 158 Binary Decimal
(1) -> 1 = 1
1 (1) 1 -> 11 = 3
1 1 (1) 0 1 -> 111 = 7
1 1 1 (0) 0 1 1 -> 1110 = 14
1 1 1 0 (1) 1 1 0 1 -> 11101 = 29
1 1 1 0 0 (1) 1 0 0 1 1 -> 111011 = 59
1 1 1 0 1 1 (1) 0 1 1 1 0 1 -> 1110111 = 119
1 1 1 0 0 1 1 (0) 0 1 1 0 0 1 1 -> 11101110 = 238
1 1 1 0 1 1 1 0 (1) 1 1 0 1 1 1 0 1 -> 111011101 = 477
(End)
MATHEMATICA
f[n_] := Block[{w = {}}, Do[AppendTo[w, Boole[Mod[k, 4] != 3]], {k, 0, n}]; FromDigits[w, 2]]; Table[f@ n, {n, 0, 32}] (* Michael De Vlieger, Dec 09 2015 *)
PROG
(Python) print([7*2**(n+2)//15 for n in range(34)]) # Karl V. Keller, Jr., Oct 01 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Robert Price, Dec 07 2015
STATUS
approved