OFFSET
1,2
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..1000
Eric Weisstein's World of Mathematics, Minimum Dominating Set
Eric Weisstein's World of Mathematics, Path Graph
Index entries for linear recurrences with constant coefficients, signature (0,0,3,0,0,-3,0,0,1).
FORMULA
a(n) = 1 for n = 0 (mod 3)
(n^2+13*n+4)/18 for n = 1 (mod 3)
(n+4)/3 for n = 2 (mod 3).
a(n) = 3*a(n-3)-3*a(n-6)+a(n-9) for n > 9.
G.f.: -(x*(1+2*x+x^2+x^3-3*x^4-2*x^5-x^6+x^7+x^8))/((-1+x)^3*(1+x+x^2)^3).
MATHEMATICA
Table[Piecewise[{{1, Mod[n, 3] == 0}, {(n^2 + 13 n + 4)/18, Mod[n, 3] == 1}, {(n + 4)/3, Mod[n, 3] == 2}}], {n, 20}]
LinearRecurrence[{0, 0, 3, 0, 0, -3, 0, 0, 1}, {1, 2, 1, 4, 3, 1, 8, 4, 1}, 20]
CoefficientList[Series[-(1 + 2 x + x^2 + x^3 - 3 x^4 - 2 x^5 - x^6 + x^7 + x^8)/((-1 + x)^3 (1 + x + x^2)^3), {x, 0, 20}], x]
PROG
(PARI) a(n)={if(n%3==0, 1, if(n%3==1, (n^2+13*n+4)/18, (n+4)/3))} \\ Andrew Howroyd, Jan 18 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric W. Weisstein, Sep 09 2021
STATUS
approved