A083220 a(n) = n + (n mod 4).
0, 2, 4, 6, 4, 6, 8, 10, 8, 10, 12, 14, 12, 14, 16, 18, 16, 18, 20, 22, 20, 22, 24, 26, 24, 26, 28, 30, 28, 30, 32, 34, 32, 34, 36, 38, 36, 38, 40, 42, 40, 42, 44, 46, 44, 46, 48, 50, 48, 50, 52, 54, 52, 54, 56, 58, 56, 58, 60, 62, 60, 62, 64, 66, 64, 66, 68, 70, 68, 70, 72, 74
Offset: 0
Examples
G.f. = 2*x + 4*x^2 + 6*x^3 + 4*x^4 + 6*x^5 + 8*x^6 + 10*x^7 + 8*x^8 + 10*x^9 + ...
Links
- Stefano Spezia, Table of n, a(n) for n = 0..10000
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
Programs
-
Mathematica
a[n_] := Mod[n, 4] + n; (* Michael Somos, Feb 23 2017 *)
-
PARI
concat(0, Vec(-2*x*(x^3-x^2-x-1)/((x-1)^2*(x+1)*(x^2+1)) + O(x^100))) \\ Colin Barker, Oct 13 2014
-
PARI
{a(n) = n%4 + n}; /* Michael Somos, Feb 23 2017 */
Formula
a(n) = 2*A083219(n).
a(n) = a(n-1) + 2*(n mod 2 + (n mod 4 -1)*(1- n mod 2)), a(0)=0.
a(n) = (3 - (-1)^n - (1+i)*(-i)^n - (1-i)*i^n + 2*n)/2 where i=sqrt(-1). - Colin Barker, Oct 13 2014
G.f.: -2*x*(x^3-x^2-x-1) / ((x-1)^2*(x+1)*(x^2+1)). - Colin Barker, Oct 13 2014
For n > 4, a(n) = a(n-4) + 4. - Zak Seidov, Feb 23 2017
G.f.: 1/(1-x)^2 + 1/(2*(1-x)) - 1/(2*(1+x)) - (1+x)/(1+x^2). - Michael Somos, Feb 23 2017
E.g.f.: (1 + x)*cosh(x) - cos(x) + (2 + x)*sinh(x) - sin(x). - Stefano Spezia, May 28 2021
Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) - 1/2 (A187832). - Amiram Eldar, Aug 21 2023