OFFSET
0,2
COMMENTS
Number of walks of length n on the following graph starting at vertex 3:
3
/|
0-1-2 |
\|
4.
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,-2).
EXAMPLE
a(2)=5 because we have the walk 3-2-1, 3-2-3, 3-2-4, 3-4-2, 3-4-3.
MAPLE
a:= n-> (<<0|1|0|0>, <0|0|1|0>, <0|0|0|1>, <-2|-2|4|1>>^n. <<1, 2, 5, 11>>)[1, 1]:
seq(a(n), n=0..31); # Alois P. Heinz, Jun 04 2025
MATHEMATICA
CoefficientList[Series[(1 + x - x^2)/(1 - x - 4*x^2 + 2*x^3 + 2*x^4), {x, 0, 31}], x] (* Michael De Vlieger, Jun 04 2025 *)
LinearRecurrence[{1, 4, -2, -2}, {1, 2, 5, 11}, 33] (* Vincenzo Librandi, Oct 13 2025 *)
PROG
(Magma) I:=[1, 2, 5, 11]; [n le 4 select I[n] else Self(n-1) + 4*Self(n-2)-2*Self(n-3)-2*Self(n-4): n in [1..35]]; // Vincenzo Librandi, Oct 13 2025
CROSSREFS
KEYWORD
nonn,walk,easy
AUTHOR
Sean A. Irvine, Jun 04 2025
STATUS
approved
