A303427 Interleaved Lucas and Fibonacci numbers.
2, 0, 1, 1, 3, 1, 4, 2, 7, 3, 11, 5, 18, 8, 29, 13, 47, 21, 76, 34, 123, 55, 199, 89, 322, 144, 521, 233, 843, 377, 1364, 610, 2207, 987, 3571, 1597, 5778, 2584, 9349, 4181, 15127, 6765, 24476, 10946, 39603, 17711, 64079, 28657, 103682, 46368, 167761
Offset: 0
Examples
a(8) = Lucas(4) = 7; a(9) = Fibonacci(4) = 3.
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (0,1,0,1).
Programs
-
MATLAB
F = zeros(1,N); L = ones(1,N); F(2) = 1; L(1) = 2 for n = 3:N F(n) = F(n-1) + F(n-2); L(n) = L(n-1) + L(n-2); end A = F; B = L; C=[B; A]; C=C(:)'; C
-
Magma
[IsEven(n) select Lucas(n div 2) else Fibonacci((n-1) div 2): n in [0..70]]; // Vincenzo Librandi, Apr 25 2018
-
Maple
a:= n-> (<<0|1>, <1|1>>^iquo(n, 2, 'r'). <<2*(1-r), 1>>)[1, 1]: seq(a(n), n=0..60); # Alois P. Heinz, Apr 23 2018
-
Mathematica
LinearRecurrence[{0, 1, 0, 1}, {2, 0, 1, 1}, 60] (* Vincenzo Librandi, Apr 25 2018 *) With[{nn=30},Riffle[LucasL[Range[0,nn]],Fibonacci[Range[0,nn]]]] (* Harvey P. Dale, Feb 25 2021 *)
-
PARI
a(n) = if(n%2, fibonacci(n\2), fibonacci(n/2-1)+fibonacci(n/2+1)); \\ Altug Alkan, Apr 25 2018
Formula
a(n) = a(n-2) + a(n-4).
G.f.: -(x+1)*(x^2-2*x+2)/(x^4+x^2-1). - Alois P. Heinz, Apr 23 2018