OFFSET
0,2
COMMENTS
Number of walks of length n starting at vertex 2 in the following graph:
0 2
\ /|
1 |
/ \|
4 3.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Sean A. Irvine, Walks on Graphs.
Index entries for linear recurrences with constant coefficients, signature (1,4,-2).
EXAMPLE
a(3)=6 because we have the walks 0-1-0-1, 0-1-2-1, 0-1-2-3, 0-1-3-1, 0-1-3-2, 0-1-4-1.
MAPLE
a:= n-> (<<0|1|0|0|0>, <1|0|1|1|1>, <0|1|0|1|0>, <0|1|1|0|0>, <0|1|0|0|0>>^n. <<1, 1, 1, 1, 1>>)[3, 1]:
seq(a(n), n=0..32);
MATHEMATICA
CoefficientList[Series[(1 + x)/(1 - x - 4*x^2 + 2*x^3), {x, 0, 32}], x]
LinearRecurrence[{1, 4, -2}, {1, 2, 6}, 33] (* Vincenzo Librandi, Oct 14 2025 *)
PROG
(Magma) I:=[1, 2, 6]; [n le 3 select I[n] else Self(n-1) + 4*Self(n-2)-2*Self(n-3): n in [1..35]]; // Vincenzo Librandi, Oct 14 2025
CROSSREFS
KEYWORD
nonn,easy,walk
AUTHOR
Sean A. Irvine, Jun 04 2025
STATUS
approved
