login
A287812
Number of octonary sequences of length n such that no two consecutive terms have distance 1.
0
1, 8, 50, 314, 1972, 12386, 77796, 488636, 3069120, 19277130, 121079578, 760500364, 4776699874, 30002433636, 188445170924, 1183623397912, 7434334035874, 46695023649050, 293291264969380, 1842161313673506, 11570608166423524, 72674945645197500
OFFSET
0,2
FORMULA
For n>4, a(n) = 7*a(n-1) - 3*a(n-2) - 10*a(n-3) + 3*a(n-2), a(0)=1, a(1)=8, a(2)=50, a(3)=314, a(4)=1972.
G.f.: (-1 - x + 3 x^2 + 2 x^3 - x^4)/(-1 + 7 x - 3 x^2 - 10 x^3 + 3 x^4).
EXAMPLE
For n=2 the a(2) = 64 - 14 = 50 sequences contain every combination except these fourteen: 01,10,12,21,23,32,34,43,45,54,56,65,67,76.
MATHEMATICA
LinearRecurrence[{7, -3, -10, 3}, {1, 8, 50, 314, 1972}, 40]
PROG
(Python)
def a(n):
.if n in [0, 1, 2, 3, 4]:
..return [1, 8, 50, 314, 1972][n]
.return 7*a(n-1)-3*a(n-2)-10*a(n-3)+3*a(n-4)
KEYWORD
nonn,easy
AUTHOR
David Nacin, Jun 02 2017
STATUS
approved