OFFSET
0,2
COMMENTS
From R. J. Mathar, Nov 22 2007: (Start)
Sequences which equal the sequence of their d-th differences obey linear recurrences with constant binomial coefficients of the form Sum_{i=0..d} binomial(d,d-i)*(-1)^i*a(n-i) = a(n-d).
If d is even, this simplifies to Sum_{i=0..d-1} binomial(d,d-i)*(-1)^i*a(n-i) = 0.
This binding of d (d odd) or d-1 (d even) consecutive terms by the recurrences leaves d or d-1, respectively, free parameters to choose a(0),a(1),...,a(d) or a(0),a(1),...,a(d-1), respectively, which ultimately define the individual sequence.
The generating functions are
d=2: a(0)/(1-2*x).
d=3: (1/3)*(-a(0) + a(1) - a(2))/(-1+2*x) + (1/3)*(-4*a(0)*x - x*a(2) + 4*a(1)*x - a(2) + 2*a(0) + a(1))/(x^2-x+1).
d=4: (1/2)*(-2*a(0) + 2*a(1) - a(2))/(-1+2*x) + (1/2)*(2*a(1)*x - 4*a(0)*x - a(2) + 2*a(1))/(1 - 2*x + 2*x^2).
In the present sequence we have d=3 and g.f. = (x-1)/(x^2-x+1) - 2/(-1+2*x). (End)
Recurrence in shorter form: a(n) = 2*a(n) + periodically extended [2, 1, -1, -2, -1, 1].
LINKS
FORMULA
a(n) = 2^(n+1) - cos((2*n+1)*Pi/6) * 2/sqrt(3). - Vladimir Reshetnikov, Oct 15 2017
G.f.: (1+x)/((1-2*x)*(1-x+x^2)). - Joerg Arndt, Oct 16 2017
EXAMPLE
Triangle of sequence and 1st, 2nd, 3rd differences:
1 4 9 17 32 63 127 256 513
3 5 8 15 31 64 129 257
2 3 7 16 33 65 128
1 4 9 17 32 63 ... equal to first row
MATHEMATICA
d = 3; nmax = 20; a[n_ /; n < d] := (n+1)^2; seq = Table[a[n], {n, 0, nmax}]; seq /. Solve[ Thread[ Take[seq, nmax - d + 1] == Differences[seq, d]]] // First (* Jean-François Alcover, Nov 07 2013 *)
LinearRecurrence[{3, -3, 2}, {1, 4, 9}, 21] (* Ray Chandler, Sep 23 2015 *)
Table[2^(n + 1) - Cos[(2 n + 1) Pi/6] 2/Sqrt[3], {n, 0, 32}] (* Vladimir Reshetnikov, Oct 15 2017 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Jul 15 2007
EXTENSIONS
Edited and extended by R. J. Mathar, Nov 22 2007
STATUS
approved