login
a(n) = 3*a(n-2) - a(n-4), a(0)=2, a(1)=1, a(2)=3, a(3)=2. Alternates Lucas (A000032) and Fibonacci (A000045) sequences for even and odd n.
(Formerly M0149)
6

%I M0149 #64 Mar 16 2022 02:58:06

%S 2,1,3,2,7,5,18,13,47,34,123,89,322,233,843,610,2207,1597,5778,4181,

%T 15127,10946,39603,28657,103682,75025,271443,196418,710647,514229,

%U 1860498,1346269,4870847,3524578,12752043,9227465,33385282,24157817

%N a(n) = 3*a(n-2) - a(n-4), a(0)=2, a(1)=1, a(2)=3, a(3)=2. Alternates Lucas (A000032) and Fibonacci (A000045) sequences for even and odd n.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H T. D. Noe, <a href="/A005247/b005247.txt">Table of n, a(n) for n = 0..500</a>

%H T. Crilly, <a href="http://www.jstor.org/stable/3617570">Double sequences of positive integers</a>, Math. Gaz., 69 (1985), 263-271.

%H R. K. Guy, <a href="/A005246/a005246.pdf">Letter to N. J. A. Sloane, Feb 1986</a>

%H Simon Plouffe, <a href="https://arxiv.org/abs/0911.4975">Approximations de séries génératrices et quelques conjectures</a>, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.

%H Simon Plouffe, <a href="/A000051/a000051_2.pdf">1031 Generating Functions</a>, Appendix to Thesis, Montreal, 1992

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,3,0,-1).

%F a(0)=2, a(1)=1, a(2)=3, a(n) = (1+a(n-1)a(n-2))/a(n-3), n >= 3. a(-n) = a(n).

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

%F a(n) = F(n) if n odd, a(n) = L(n) if n even. a(n) = F(n+1)+(-1)^nF(n-1). - Mario Catalani (mario.catalani(AT)unito.it), Sep 20 2002

%F a(n) = ((5+sqrt(5))/10)*(((1+sqrt(5))/2)^n+((-1+sqrt(5))/2)^n)+((5-sqrt(5))/10)*(((1-sqrt(5))/2)^n+((-1-sqrt(5))/2)^n). With additional leading 1: a(n)=((sqrt(5))/5)*(((1+sqrt(5))/2)^n-((1-sqrt(5))/2)^n)+((5+3*sqrt(5))/10)*((-1+sqrt(5))/2)^n+((5-3*sqrt(5))/10)*((-1-sqrt(5))/2)^n. - _Tim Monahan_, Jul 25 2011

%F From _Peter Bala_, Jan 11 2013: (Start)

%F Let phi = 1/2*(sqrt(5) - 1). This sequence is the simple continued fraction expansion of the real number 1 + product {n >= 0} (1 + sqrt(5)*phi^(4*n+1))/(1 + sqrt(5)*phi^(4*n+3)) = 2.77616 23282 02325 23857 ... = 2 + 1/(1 + 1/(3 + 1/(2 + 1/(7 + ...)))). Cf. A005248.

%F Furthermore, for k = 0,1,2,... the simple continued fraction expansion of 1 + product {n >= 0} (1 + 1/5^k*sqrt(5)*phi^(4*n+1))/(1 + 1/5^k*sqrt(5)*phi^(4*n+3)) equals [2; 1*5^k, 3, 2*5^k, 7, 5*5^k, 18, 13*5^k, 47, ...]. (End)

%F a(n) = hypergeom([(1-n)/2, n mod 2 - n/2], [1 - n], -4) for n > 2. - _Peter Luschny_, Sep 03 2019

%F E.g.f.: 2*cosh(x/2)*(5*cosh(sqrt(5)*x/2) + sqrt(5)*sinh(sqrt(5)*x/2))/5. - _Stefano Spezia_, Mar 15 2022

%p with(combinat): A005247 := n-> if n mod 2 = 1 then fibonacci(n) else fibonacci(n+1)+fibonacci(n-1); fi;

%p A005247:=-(z+1)*(3*z**2-z-1)/(z**2-z-1)/(z**2+z-1); # _Simon Plouffe_ in his 1992 dissertation. Gives sequence with an additional leading 1.

%t CoefficientList[Series[(2 + x - 3x^2 - x^3)/(1 - 3x^2 + x^4), {x, 0, 40}], x]

%t LinearRecurrence[{0,3,0,-1},{2,1,3,2},50] (* _Harvey P. Dale_, Oct 10 2012 *)

%o (PARI) a(n)=if(n%2,fibonacci(n),fibonacci(n+1)+fibonacci(n-1))

%o (Haskell)

%o a005247 n = a005247_list !! n

%o a005247_list = f a000032_list a000045_list where

%o f (x:_:xs) (_:y:ys) = x : y : f xs ys

%o -- _Reinhard Zumkeller_, Dec 27 2012

%o (Magma) I:=[2,1,3,2]; [n le 4 select I[n] else 3*Self(n-2) - Self(n-2): n in [1..30]]; // _G. C. Greubel_, Dec 21 2017

%Y Cf. A000032, A000045, A005013, A005013, A005246, A005248.

%K nonn,nice,easy

%O 0,1

%A _N. J. A. Sloane_

%E Additional comments from _Michael Somos_, May 01 2000