OFFSET
0,4
COMMENTS
Coefficients in expansion of e/3 = Sum_{n>=1} a(n)/n!, using greedy algorithm.
Numerators of Peirce sequence of order 2.
REFERENCES
R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, Reading, MA, 2nd ed. 1998, p. 151.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,0,2,0,0,-1).
FORMULA
G.f.: x^2*(x^3+x^2+2*x+1) / ((x-1)^2*(x^2+x+1)^2). - Colin Barker, Aug 31 2013
a(n) = (n^2-n+floor(n/3)*(18*floor(n/3)^2-3*(4*n-7)*floor(n/3)+2*n^2-10*n+7))/2. - Luce ETIENNE, Mar 29 2017
Sum_{n>=2} (-1)^n/a(n) = Pi/4 + log(2)/2. - Amiram Eldar, Jan 11 2023
MAPLE
A009947 := proc(a, n) local i, b, c; b := a; c := [ floor(b) ]; for i from 1 to n-1 do b := b-c[ i ]/i!; c := [ op(c), floor(b*(i+1)!) ]; od; c; end:
MATHEMATICA
Flatten[Table[If[EvenQ[n], {n, n/2}, n], {n, 0, 40}]] (* Harvey P. Dale, Feb 17 2016 *)
PROG
(Haskell)
a009947 n = a009947_list !! n
a009947_list = concatMap (\x -> [2 * x, x, 2 * x + 1]) [0..]
-- Reinhard Zumkeller, Jul 06 2012
(PARI) a(n)=if(n%3==1, n\3, n\3*2+!!(n%3)) \\ Charles R Greathouse IV, Sep 02 2015
(PARI) concat(vector(2), Vec(x^2*(x^3+x^2+2*x+1) / ((x-1)^2*(x^2+x+1)^2) + O(x^100))) \\ Colin Barker, Mar 29 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved