%I #22 Sep 08 2022 08:45:48
%S 6,10,15,21,28,35,42,49,56,63,70,77,84,91,98,105,112,119,126,133,140,
%T 147,154,161,168,175,182,189,196,203,210,217,224,231,238,245,252,259,
%U 266,273,280,287,294,301,308,315,322,329,336,343,350,357,364,371,378
%N a(n) = sum of natural numbers m such that n - 3 <= m <= n + 3.
%C 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.
%H Colin Barker, <a href="/A168102/b168102.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (2,-1).
%F a(n) = a(n-1) + 7 for n >= 4.
%F a(n) = 2*a(n-1) - a(n-2) for n>4. - _Colin Barker_, Feb 12 2015
%F G.f.: (6-2*x+x^2+x^3+x^4) / (1-x)^2. - _Colin Barker_, Feb 12 2015
%t LinearRecurrence[{2, -1}, {6, 10, 15, 21, 28}, 60] (* _G. C. Greubel_, Jul 12 2016; amended by _Georg Fischer_, Apr 03 2019 *)
%t Join[{6,10,15},NestList[#+7&,21,60]] (* _Harvey P. Dale_, May 07 2022 *)
%o (PARI) Vec((x^4+x^3+x^2-2*x+6)/(x-1)^2 + O(x^60)) \\ _Colin Barker_, Feb 12 2015
%o (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
%o (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
%o (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
%K nonn,easy
%O 0,1
%A _Jaroslav Krizek_, Nov 18 2009
|