%I #8 Jun 05 2017 15:10:03
%S 1,8,50,314,1972,12386,77796,488636,3069120,19277130,121079578,
%T 760500364,4776699874,30002433636,188445170924,1183623397912,
%U 7434334035874,46695023649050,293291264969380,1842161313673506,11570608166423524,72674945645197500
%N Number of octonary sequences of length n such that no two consecutive terms have distance 1.
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (7, -3, -10, 3).
%F 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.
%F G.f.: (-1 - x + 3 x^2 + 2 x^3 - x^4)/(-1 + 7 x - 3 x^2 - 10 x^3 + 3 x^4).
%e 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.
%t LinearRecurrence[{7, -3, -10, 3}, {1, 8, 50, 314, 1972}, 40]
%o (Python)
%o def a(n):
%o .if n in [0, 1, 2, 3, 4]:
%o ..return [1, 8, 50, 314, 1972][n]
%o .return 7*a(n-1)-3*a(n-2)-10*a(n-3)+3*a(n-4)
%Y Cf. A040000, A003945, A083318, A078057, A003946, A126358, A003946, A055099, A003947, A015448, A126473. A287804-A287819.
%K nonn,easy
%O 0,2
%A _David Nacin_, Jun 02 2017
|