OFFSET
1,1
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
Index entries for linear recurrences with constant coefficients, signature (0,1,1,0,-1).
FORMULA
G.f.: x * (2 + 2*x + x^2) / (1 - x^2 - x^3 + x^5) = (2*x + 2*x^2 + x^3) / ((1 - x^2) * (1 - x^3)).
E.g.f.: 5*x*exp(x)/6 - exp(-x)/4 + 7*exp(x)/12 + sin(sqrt(3)*x/2)*exp(-x/2)/(3*sqrt(3)) - cos(sqrt(3)*x/2)*exp(-x/2)/3. - Ilya Gutkovskiy, Apr 13 2016
EXAMPLE
G.f. = 2*x + 2*x^2 + 3*x^3 + 4*x^4 + 5*x^5 + 5*x^6 + 7*x^7 + 7*x^8 + ...
MAPLE
MATHEMATICA
a[ n_] := Ceiling[ n / 2 ] + Ceiling[ n / 3 ];
LinearRecurrence[{0, 1, 1, 0, -1}, {2, 2, 3, 4, 5}, 100] (* Vincenzo Librandi, Apr 15 2016 *)
Rest[CoefficientList[Series[x*(2+2*x+x^2)/(1-x^2-x^3+x^5), {x, 0, 50}], x]] (* G. C. Greubel, Aug 06 2018 *)
PROG
(PARI) {a(n) = ceil( n / 2 ) + ceil( n / 3 )};
(PARI) {a(n) = if( n<0, polcoeff( -(x^2 + 2*x^3 + 2*x^4) / ((1 - x^2) * (1 - x^3)) + x * O(x^-n), -n), polcoeff( (2*x + 2*x^2 + x^3) / ((1 - x^2) * (1 - x^3)) + x * O(x^n), n))};
(Magma) m:=50; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!(x*(2+2*x+x^2)/(1-x^2-x^3+x^5))); // G. C. Greubel, Aug 06 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michael Somos, May 22 2014
STATUS
approved