login
A287806
Number of senary sequences of length n such that no two consecutive terms have distance 1.
0
1, 6, 26, 114, 500, 2194, 9628, 42252, 185422, 813722, 3571010, 15671340, 68773514, 301811860, 1324498252, 5812546998, 25508302906, 111942925778, 491260382084, 2155891150146, 9461106209228, 41519967599596, 182209952129086, 799626506818554, 3509152727035810
OFFSET
0,2
FORMULA
For n>3, a(n) = 5*a(n-1) - 2*a(n-2) - 3*a(n-3), a(1)=6, a(2)=26, a(3)=114.
G.f.: (1 + x - 2*x^2 - x^3)/(1 - 5*x + 2*x^2 + 3*x^3).
EXAMPLE
For n=2 the a(2)=26=36-10 sequences contain every combination except these ten: 01,10,12,21,23,32,34,43,45,54.
MATHEMATICA
LinearRecurrence[{5, -2, -3}, {1, 6, 26, 114}, 40]
PROG
(Python)
def a(n):
.if n in [0, 1, 2, 3]:
..return [1, 6, 26, 114][n]
.return 5*a(n-1)-2*a(n-2)-3*a(n-3)
KEYWORD
nonn,easy
AUTHOR
David Nacin, Jun 01 2017
STATUS
approved