OFFSET
0,2
COMMENTS
In general, the number of sequences over the alphabet {0,1,...,9} such that no two consecutive terms have distance 5+k for k in {0,1,2,3,4} is given by a(n) = 9*a(n-1) + 2*k*a(n-2), a(0)=1, a(1)=10.
LINKS
FORMULA
a(n) = 9*a(n-1) + 6*a(n-2), a(0)=1, a(1)=10.
G.f.: (-1 - x)/(-1 + 9*x + 6*x^2).
a(n) = ((1 - 11/sqrt(105))/2)*((9 - sqrt(105))/2)^n + ((1 + 11/sqrt(105))/2)*((9 + sqrt(105))/2)^n.
MATHEMATICA
LinearRecurrence[{9, 6}, {1, 10}, 30]
PROG
(Python)
def a(n):
.if n in [0, 1]:
..return [1, 10][n]
.return 9*a(n-1)+6*a(n-2)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
David Nacin, Jun 02 2017
STATUS
approved