login
Number of (s(0), s(1), ..., s(2n)) such that 0 < s(i) < 8 and |s(i) - s(i-1)| = 1 for i = 1,2,...,2n, s(0) = 3, s(2n) = 5.
2

%I #23 Mar 03 2026 04:40:55

%S 1,4,15,54,190,660,2276,7816,26776,91600,313104,1069728,3653728,

%T 12477504,42606656,145479808,496722304,1695962368,5790470400,

%U 19770087936,67499673088,230459040768,786837865472,2686435477504,9172070373376,31315418927104,106917551738880,365039402655744,1246322574254080

%N Number of (s(0), s(1), ..., s(2n)) such that 0 < s(i) < 8 and |s(i) - s(i-1)| = 1 for i = 1,2,...,2n, s(0) = 3, s(2n) = 5.

%C In general, a(n) = (2/m)*Sum_{r=1..m-1} sin(r*j*Pi/m)*sin(r*k*Pi/m)*(2*cos(r*Pi/m))^(2n) counts (s(0), s(1), ..., s(2n)) such that 0 < s(i) < m and |s(i) - s(i-1)| = 1 for i = 1,2,...,2n, s(0) = j, s(2n) = k.

%H Michael De Vlieger, <a href="/A094821/b094821.txt">Table of n, a(n) for n = 1..1875</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (6,-10,4).

%F a(n) = (1/4)*Sum_{r=1..7} sin(3*r*Pi/8)*sin(5*r*Pi/8)*(2*cos(r*Pi/8))^(2n).

%F a(n) = 6*a(n-1) - 10*a(n-2) + 4*a(n-3), n >= 4.

%F G.f.: x*(1-x)^2 / ( (1-2*x)*(1-4*x+2*x^2) ).

%F 4*a(n) = 2*A007052(n) - 2^n. - _R. J. Mathar_, Nov 14 2019

%F E.g.f.: (exp(2*x)*(2*cosh(sqrt(2)*x) + sqrt(2)*sinh(sqrt(2)*x) - 1) - 1)/4. - _Stefano Spezia_, Apr 25 2023

%t Rest@ CoefficientList[Series[x (1-x)^2/((1 - 2 x) (1 -4 x +2 x^2)), {x,0,35}], x] (* _Michael De Vlieger_, Feb 12 2022 *)

%o (Magma)

%o I:=[1,4,15]; [n le 3 select I[n] else 6*Self(n-1) -10*Self(n-2) +4*Self(n-3): n in [1..50]]; // _G. C. Greubel_, Mar 03 2026

%o (SageMath)

%o A007052= BinaryRecurrenceSequence(4,-2,1,3)

%o def A094821(n): return (A007052(n) - 2^(n-1))//2

%o print([A094821(n) for n in range(1,51)]) # _G. C. Greubel_, Mar 03 2026

%Y Cf. A007052.

%K nonn,easy

%O 1,2

%A _Herbert Kociemba_, Jun 12 2004