OFFSET
1,3
LINKS
Eric Weisstein's World of Mathematics, Graph Cycle.
Eric Weisstein's World of Mathematics, Pell Graph.
PROG
(Python)
from itertools import product, combinations, groupby, islice
from networkx import empty_graph, simple_cycles
def A368189(n):
if n<=1 : return 0
G = empty_graph(v for v in product((0, 1, 2), repeat=n) if not any(len(list(g))&1 and k==2 for k, g in groupby(v)))
for a, b in combinations(G, 2):
r = tuple(islice((i for i in range(n) if a[i]!=b[i]), 3))
if len(r)==1 and a[r[0]]!=2 and b[r[0]]!=2:
G.add_edge(a, b)
elif len(r)==2 and r[0]+1==r[1] and a[r[0]] and b[r[0]] and a[r[0]]==a[r[1]] and b[r[0]]==b[r[1]]:
G.add_edge(a, b)
return sum(1 for c in simple_cycles(G)) # Chai Wah Wu, Jan 18 2024
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Eric W. Weisstein, Dec 16 2023
STATUS
approved