A130481 a(n) = Sum_{k=0..n} (k mod 3) (i.e., partial sums of A010872).
0, 1, 3, 3, 4, 6, 6, 7, 9, 9, 10, 12, 12, 13, 15, 15, 16, 18, 18, 19, 21, 21, 22, 24, 24, 25, 27, 27, 28, 30, 30, 31, 33, 33, 34, 36, 36, 37, 39, 39, 40, 42, 42, 43, 45, 45, 46, 48, 48, 49, 51, 51, 52, 54, 54, 55, 57, 57, 58, 60, 60, 61, 63, 63, 64, 66, 66, 67, 69, 69, 70, 72, 72
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
Crossrefs
Programs
-
GAP
List([0..80], n-> Int((n+1)/3) + Int(2*(n+1)/3)); # G. C. Greubel, Aug 31 2019
-
Magma
[Floor((n+1)/3) + Floor(2*(n+1)/3): n in [0..80]]; // G. C. Greubel, Aug 31 2019
-
Maple
seq(coeff(series(x*(1+2*x)/((1-x^3)*(1-x)), x, n+1), x, n), n = 0..80); # G. C. Greubel, Aug 31 2019
-
Mathematica
a[n_]:= Floor[(n+1)/3] + Floor[2(n+1)/3]; Table[a[n], {n, 0, 80}] (* Clark Kimberling, May 28 2012 *) a[n_]:= IntegerExponent[A104537[n + 1], 2]; Table[a[n], {n, 0, 80}] (* Gerry Martens, Jul 14 2015 *) CoefficientList[Series[x(1+2x)/((1-x^3)(1-x)), {x, 0, 80}], x] (* Stefano Spezia, Sep 09 2018 *) LinearRecurrence[{1,0,1,-1},{0,1,3,3},100] (* Harvey P. Dale, Jun 14 2021 *)
-
PARI
main(size)=my(n,k);vector(size,n,sum(k=0,n,k%3)) \\ Anders Hellström, Jul 14 2015
-
PARI
first(n)=my(s); concat(0, vector(n,k,s+=k%3)) \\ Charles R Greathouse IV, Jul 14 2015
-
PARI
a(n)=n\3*3+[0,1,3][n%3+1] \\ Charles R Greathouse IV, Jul 14 2015
-
Sage
def A130481_list(prec): P.
= PowerSeriesRing(ZZ, prec) return P(x*(1+2*x)/((1-x^3)*(1-x))).list() A130481_list(80) # G. C. Greubel, Aug 31 2019
Formula
G.f.: x*(1 + 2*x)/((1-x^3)*(1-x)).
a(n) = n + 1 - (Fibonacci(n+1) mod 2). - Gary Detlefs, Mar 13 2011
a(n) = floor((n+1)/3) + floor(2*(n+1)/3). - Clark Kimberling, May 28 2010
a(n) = n when n+1 is not a multiple of 3, and a(n) = n+1 when n+1 is a multiple of 3. - Dennis P. Walsh, Aug 06 2012
a(n) = n + 1 - sign((n+1) mod 3). - Wesley Ivan Hurt, Sep 25 2017
a(n) = n + (1-cos(2*(n+2)*Pi/3))/3 + sin(2*(n+2)*Pi/3)/sqrt(3). - Wesley Ivan Hurt, Sep 27 2017
a(n) = n + 1 - (n+1)^2 mod 3. - Ammar Khatab, Aug 14 2020
E.g.f.: ((1 + 3*x)*cosh(x) - (cos(sqrt(3)*x/2) + sqrt(3)*sin(sqrt(3)*x/2))*(cosh(x/2) - sinh(x/2)) + (1 + 3*x)*sinh(x))/3. - Stefano Spezia, May 28 2021
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/(3*sqrt(3)) + log(2)/3. - Amiram Eldar, Sep 17 2022
Comments