A005247 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.
2, 1, 3, 2, 7, 5, 18, 13, 47, 34, 123, 89, 322, 233, 843, 610, 2207, 1597, 5778, 4181, 15127, 10946, 39603, 28657, 103682, 75025, 271443, 196418, 710647, 514229, 1860498, 1346269, 4870847, 3524578, 12752043, 9227465, 33385282, 24157817
Offset: 0
References
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
- T. D. Noe, Table of n, a(n) for n = 0..500
- T. Crilly, Double sequences of positive integers, Math. Gaz., 69 (1985), 263-271.
- R. K. Guy, Letter to N. J. A. Sloane, Feb 1986
- Simon Plouffe, Approximations de séries génératrices et quelques conjectures, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
- Simon Plouffe, 1031 Generating Functions, Appendix to Thesis, Montreal, 1992
- Index entries for linear recurrences with constant coefficients, signature (0,3,0,-1).
Programs
-
Haskell
a005247 n = a005247_list !! n a005247_list = f a000032_list a000045_list where f (x::xs) (:y:ys) = x : y : f xs ys -- Reinhard Zumkeller, Dec 27 2012
-
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
-
Maple
with(combinat): A005247 := n-> if n mod 2 = 1 then fibonacci(n) else fibonacci(n+1)+fibonacci(n-1); fi; 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.
-
Mathematica
CoefficientList[Series[(2 + x - 3x^2 - x^3)/(1 - 3x^2 + x^4), {x, 0, 40}], x] LinearRecurrence[{0,3,0,-1},{2,1,3,2},50] (* Harvey P. Dale, Oct 10 2012 *)
-
PARI
a(n)=if(n%2,fibonacci(n),fibonacci(n+1)+fibonacci(n-1))
Formula
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).
G.f.: (2+x-3*x^2-x^3)/((1-x-x^2)*(1+x-x^2))
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
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
From Peter Bala, Jan 11 2013: (Start)
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.
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)
a(n) = hypergeom([(1-n)/2, n mod 2 - n/2], [1 - n], -4) for n > 2. - Peter Luschny, Sep 03 2019
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
Extensions
Additional comments from Michael Somos, May 01 2000