A215005 a(n) = a(n-2) + a(n-1) + floor(n/2) + 1 for n > 1 and a(0)=0, a(1)=1.
0, 1, 3, 6, 12, 21, 37, 62, 104, 171, 281, 458, 746, 1211, 1965, 3184, 5158, 8351, 13519, 21880, 35410, 57301, 92723, 150036, 242772, 392821, 635607, 1028442, 1664064, 2692521, 4356601, 7049138, 11405756, 18454911, 29860685, 48315614, 78176318, 126491951, 204668289
Offset: 0
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (2,1,-3,0,1).
Crossrefs
Programs
-
Magma
[2*Fibonacci(n+2) -(2*n+9-(-1)^n)/4: n in [0..50]]; // G. C. Greubel, Apr 05 2024
-
Mathematica
LinearRecurrence[{2,1,-3,0,1}, {0,1,3,6,12}, 39] (* Jean-François Alcover, Oct 05 2017 *) nxt[{n_,a_,b_}]:={n+1,b,a+b+Floor[(n+1)/2]+1}; NestList[nxt,{1,0,1},40][[;;,2]] (* Harvey P. Dale, Feb 20 2025 *)
-
PARI
concat(0, Vec(x*(1+x-x^2)/((1-x)^2*(1+x)*(1-x-x^2)) + O(x^100))) \\ Colin Barker, Sep 16 2015
-
Python
prpr = 0 prev = 1 for n in range(2,100): print(prpr, end=', ') curr = prpr+prev + 1 + n//2 prpr = prev prev = curr
-
SageMath
[2*fibonacci(n+2) -(n+4+(n%2))//2 for n in range(51)] # G. C. Greubel, Apr 05 2024
Formula
a(n) = 2*Fibonacci(n+2) - (2*n + 9 - (-1)^n)/4. - Vaclav Kotesovec, Aug 11 2012
From Colin Barker, Sep 16 2015: (Start)
a(n) = 2*a(n-1) + a(n-2) - 3*a(n-3) + a(n-5) for n>4.
G.f.: x*(1+x-x^2) / ((1-x)^2*(1+x)*(1-x-x^2)). (End)
E.g.f.: 2*exp(x/2)*(cosh(sqrt(5)*x/2) + (3/sqrt(5))*sinh(sqrt(5)*x/2)) - (1/2)*((x+4)*cosh(x) + (x+5)*sinh(x)). - G. C. Greubel, Apr 05 2024
Comments