A130482 a(n) = Sum_{k=0..n} (k mod 4) (Partial sums of A010873).
0, 1, 3, 6, 6, 7, 9, 12, 12, 13, 15, 18, 18, 19, 21, 24, 24, 25, 27, 30, 30, 31, 33, 36, 36, 37, 39, 42, 42, 43, 45, 48, 48, 49, 51, 54, 54, 55, 57, 60, 60, 61, 63, 66, 66, 67, 69, 72, 72, 73, 75, 78, 78, 79, 81, 84, 84, 85, 87, 90, 90, 91, 93, 96, 96, 97, 99, 102, 102, 103, 105
Offset: 0
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
Programs
-
GAP
a:=[0,1,3,6,6];; for n in [6..71] do a[n]:=a[n-1]+a[n-4]-a[n-5]; od; a; # G. C. Greubel, Aug 31 2019
-
Magma
I:=[0,1,3,6,6]; [n le 5 select I[n] else Self(n-1) + Self(n-4) - Self(n-5): n in [1..71]]; // G. C. Greubel, Aug 31 2019
-
Maple
a:=n->add(chrem( [n,j], [1,4] ),j=1..n):seq(a(n), n=0..70); # Zerinvary Lajos, Apr 07 2009
-
Mathematica
Table[(6*n +(1-(-1)^n)*(1+2*I^(n+1)))/4, {n,0,70}] (* G. C. Greubel, Aug 31 2019 *) LinearRecurrence[{1,0,0,1,-1},{0,1,3,6,6},80] (* Harvey P. Dale, Feb 16 2024 *)
-
PARI
a(n) = (1 - (-1)^n - (2*I)*(-I)^n + (2*I)*I^n + 6*n) / 4 \\ Colin Barker, Oct 15 2015
-
Sage
def A130482_list(prec): P.
= PowerSeriesRing(ZZ, prec) return P(x*(1+2*x+3*x^2)/((1-x^4)*(1-x))).list() A130482_list(70) # G. C. Greubel, Aug 31 2019
Formula
G.f.: x*(1 + 2*x + 3*x^2)/((1-x^4)*(1-x)).
a(n) = (1 - (-1)^n - (2*i)*(-i)^n + (2*i)*i^n + 6*n) / 4 where i = sqrt(-1). - Colin Barker, Oct 15 2015
a(n) = 3*n/2 + (n mod 2)* ( (n-1) mod 4 ) - (n mod 2)/2. - Ammar Khatab, Aug 27 2020
E.g.f.: (3*x*exp(x) - 2*sin(x) + sinh(x))/2. - Stefano Spezia, Apr 22 2021
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/(4*sqrt(3)) + log(3)/4. - Amiram Eldar, Sep 17 2022
Comments