%I #24 Jan 25 2023 11:51:32
%S 1,2,3,4,7,10,17,26,43,68,111,178,289,466,755,1220,1975,3194,5169,
%T 8362,13531,21892,35423,57314,92737,150050,242787,392836,635623,
%U 1028458,1664081,2692538,4356619,7049156,11405775,18454930,29860705,48315634,78176339
%N a(n) = 2*(A000045(n)-(n mod 2)) + 1 + (n mod 2).
%C This is an auxiliary sequence for computing A138606.
%H G. C. Greubel, <a href="/A166012/b166012.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (1,2,-1,-1).
%F a(2n) = 2*A000045(2n) + 1, a(2n+1) = 2*A000045(2n+1).
%F Without reference to A000045: a(n)=2*Floor(a(n-1)/2)+a(n-2). - _Clark Kimberling_, Nov 07 2009
%F If n mod 2 = 0 then a(n) = a(n-1) + a(n-2), else a(n) = a(n-1) + a(n-2) - 1.
%F a(n) = 2*Fibonacci(n) + (1+(-1)^n)/2.
%F a(n) = 2*Fibonacci(n) + [(n+1)mod 2]. - _Gary Detlefs_, Dec 29 2010
%F G.f.: (1 + x - x^2 - 2*x^3)/((1 - x^2)*(1 - x - x^2)). - _Ilya Gutkovskiy_, Apr 22 2016
%F From _Colin Barker_, Apr 22 2016: (Start)
%F a(n) = a(n-1)+2*a(n-2)-a(n-3)-a(n-4) for n>3.
%F a(n) = (1/2+(-1)^n/2-(2*((1/2*(1-sqrt(5)))^n-(1/2*(1+sqrt(5)))^n))/sqrt(5)).
%F (End)
%t Table[2*Fibonacci[n] + (1 + (-1)^n)/2, {n, 0, 100}] (* _G. C. Greubel_, Apr 21 2016 *)
%t LinearRecurrence[{1,2,-1,-1},{1,2,3,4},40] (* _Harvey P. Dale_, May 01 2018 *)
%o (MIT Scheme:) (define (A166012 n) (+ 1 (modulo n 2) (* 2 (- (A000045 n) (modulo n 2)))))
%o (PARI) Vec((1+x-x^2-2*x^3)/((1-x)*(1+x)*(1-x-x^2)) + O(x^50)) \\ _Colin Barker_, Apr 22 2016
%K nonn,easy
%O 0,2
%A _Antti Karttunen_, Oct 05 2009