OFFSET
0,1
COMMENTS
a(n) = a(n-1) + 7 for n >= 4. Generalization: If a(n,k) = sum of natural numbers m such that n - k <= m <= n + k (k >= 1) then a(n,k) = (k + n) * (k + n + 1)/2 = A000217(k+n) for 0 <= n <= k, a(n,k) = a(n-1,k) + 2k + 1 = ((k + n - 1)*(k + n)/2) + 2k + 1 = A000217(k+n-1) +2k +1 for n >= k + 1 (see, e.g., A008486). a(n) = (3 + n)*(4 + n)/2 = A000217(3+n) for 0 <= n <= 3, a(n) = a(n-1) + 7 for n >= 4.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,-1).
FORMULA
a(n) = a(n-1) + 7 for n >= 4.
a(n) = 2*a(n-1) - a(n-2) for n>4. - Colin Barker, Feb 12 2015
G.f.: (6-2*x+x^2+x^3+x^4) / (1-x)^2. - Colin Barker, Feb 12 2015
MATHEMATICA
LinearRecurrence[{2, -1}, {6, 10, 15, 21, 28}, 60] (* G. C. Greubel, Jul 12 2016; amended by Georg Fischer, Apr 03 2019 *)
Join[{6, 10, 15}, NestList[#+7&, 21, 60]] (* Harvey P. Dale, May 07 2022 *)
PROG
(PARI) Vec((x^4+x^3+x^2-2*x+6)/(x-1)^2 + O(x^60)) \\ Colin Barker, Feb 12 2015
(Magma) R<x>:=PowerSeriesRing(Integers(), 60); Coefficients(R!( (6-2*x+x^2+x^3+x^4)/(1-x)^2 )); // G. C. Greubel, Apr 03 2019
(Sage) ((6-2*x+x^2+x^3+x^4)/(1-x)^2).series(x, 60).coefficients(x, sparse=False) # G. C. Greubel, Apr 03 2019
(GAP) a:=[21, 28];; for n in [3..60] do a[n]:=2*a[n-1]-a[n-2]; od; Concatenation([6, 10, 15], a); # G. C. Greubel, Apr 03 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jaroslav Krizek, Nov 18 2009
STATUS
approved