OFFSET
1,2
COMMENTS
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
FORMULA
G.f.: x*(1+2*x*(1-x^2+x^3)/((1+x)*(1-x)^3)).
From Colin Barker, Mar 27 2020: (Start)
a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) for n>5.
a(n) = (9 + (-1)^(1+n) - 4*n + 2*n^2) / 4 for n>1. (End)
E.g.f.: ((4 - x + x^2)*cosh(x) + (5 - x + x^2)*sinh(x) - 2*(2 + x))/2. - Stefano Spezia, Jun 14 2023
EXAMPLE
a(1) = 1;
+--+
a(2) = 2;
+ + *--*
| | | |
*--* + +
a(3) = 4;
+ + +--* *--+ *--*
| | | | | |
* * *--* *--* * *
| | | | | |
*--* *--+ +--* + +
PROG
(PARI) N=66; x='x+O('x^N); Vec(x*(1+2*x*(1-x^2+x^3)/((1+x)*(1-x)^3)))
(Python)
# Using graphillion
from graphillion import GraphSet
import graphillion.tutorial as tl
def A(start, goal, n, k):
universe = tl.grid(n - 1, k - 1)
GraphSet.set_universe(universe)
paths = GraphSet.paths(start, goal, is_hamilton=True)
return paths.len()
def A333571(n, k):
if n == 1: return 1
s = 0
for i in range(1, n + 1):
for j in range(k * n - n + 1, k * n + 1):
s += A(i, j, k, n)
return s
def A333574(n):
return A333571(n, 2)
print([A333574(n) for n in range(1, 25)])
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Seiichi Manyama, Mar 27 2020
STATUS
approved