OFFSET
0,2
COMMENTS
Number of black cells after n iterations of Haferman's carpet.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Eric Weisstein's World of Mathematics, Haferman Carpet
Index entries for linear recurrences with constant coefficients, signature (4,45).
FORMULA
From Colin Barker, Jun 08 2013: (Start)
a(n) = 4*a(n-1) + 45*a(n-2).
G.f.: 1 / ((1+5*x)*(1-9*x)). (End)
E.g.f.: (1/14)*(5*exp(-5*x) + 9*exp(9*x)). - G. C. Greubel, Nov 12 2024
MATHEMATICA
LinearRecurrence[{4, 45}, {1, 4}, 41] (* G. C. Greubel, Nov 12 2024 *)
PROG
(PARI) Vec(1 / ((1 + 5*x)*(1 - 9*x)) + O(x^40)) \\ Colin Barker, Feb 26 2020
(Magma) [n le 2 select 4^(n-1) else 4*Self(n-1) +45*Self(n-2): n in [1..41]]; // G. C. Greubel, Nov 12 2024
(Python)
def A118005(n): return (9^(n+1) +(-1)^n*5^(n+1))//14
print([A118005(n) for n in range(41)]) # G. C. Greubel, Nov 12 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Eric W. Weisstein, Apr 09 2006
STATUS
approved