login
A287834
Number of words of length n over the alphabet {0,1,...,10} such that no two consecutive terms have distance 3.
0
1, 11, 105, 1005, 9621, 92105, 881753, 8441329, 80811789, 773639469, 7406320733, 70903294113, 678781988705, 6498216958121, 62209699634757, 595555173609653, 5701457600593525, 54582044135967257, 522532964509030377, 5002390498942001761, 47889630709552579709
OFFSET
0,2
FORMULA
a(n) = 10*a(n-1) - 2*a(n-2) - 21*a(n-3) + 10*a(n-4), a(0)=1, a(1)=11, a(2)=105, a(3)=1005, a(4)=9621.
G.f.: (-1 - x + 3*x^2 + 2*x^3 - 2*x^4)/(-1 + 10*x - 2*x^2 - 21*x^3 + 10*x^4).
MATHEMATICA
LinearRecurrence[{10, -2, -21, 10}, {1, 11, 105, 1005, 9621}, 20]
PROG
(Python)
def a(n):
.if n in [0, 1, 2, 3, 4]:
..return [1, 11, 105, 1005, 9621][n]
.return 10*a(n-1) - 2*a(n-2) - 21*a(n-3) + 10*a(n-4)
KEYWORD
nonn,easy
AUTHOR
David Nacin, Jun 07 2017
STATUS
approved