login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = n + (n mod 4).
6

%I #47 Dec 31 2023 11:27:40

%S 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,

%T 26,28,30,28,30,32,34,32,34,36,38,36,38,40,42,40,42,44,46,44,46,48,50,

%U 48,50,52,54,52,54,56,58,56,58,60,62,60,62,64,66,64,66,68,70,68,70,72,74

%N a(n) = n + (n mod 4).

%H Stefano Spezia, <a href="/A083220/b083220.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).

%F a(n) = 2*A083219(n).

%F a(n) = a(n-1) + 2*(n mod 2 + (n mod 4 -1)*(1- n mod 2)), a(0)=0.

%F 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

%F G.f.: -2*x*(x^3-x^2-x-1) / ((x-1)^2*(x+1)*(x^2+1)). - _Colin Barker_, Oct 13 2014

%F For n > 4, a(n) = a(n-4) + 4. - _Zak Seidov_, Feb 23 2017

%F G.f.: 1/(1-x)^2 + 1/(2*(1-x)) - 1/(2*(1+x)) - (1+x)/(1+x^2). - _Michael Somos_, Feb 23 2017

%F E.g.f.: (1 + x)*cosh(x) - cos(x) + (2 + x)*sinh(x) - sin(x). - _Stefano Spezia_, May 28 2021

%F Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) - 1/2 (A187832). - _Amiram Eldar_, Aug 21 2023

%e 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 + ...

%t a[n_] := Mod[n, 4] + n; (* _Michael Somos_, Feb 23 2017 *)

%o (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

%o (PARI) {a(n) = n%4 + n}; /* _Michael Somos_, Feb 23 2017 */

%Y Cf. A010873 (n mod 4), A083219, A187832.

%K nonn,easy

%O 0,2

%A _Reinhard Zumkeller_, Apr 22 2003