login
a(4*n) = 2*n, a(2*n+1) = 2*n+1, a(4*n+2) = 2*n+2.
6

%I #43 Sep 08 2022 08:46:02

%S 0,1,2,3,2,5,4,7,4,9,6,11,6,13,8,15,8,17,10,19,10,21,12,23,12,25,14,

%T 27,14,29,16,31,16,33,18,35,18,37,20,39,20,41,22,43,22,45,24,47,24,49,

%U 26,51,26,53,28,55,28,57,30,59,30,61,32,63,32,65,34,67,34,69,36,71,36,73,38,75

%N a(4*n) = 2*n, a(2*n+1) = 2*n+1, a(4*n+2) = 2*n+2.

%C First differences: (1, 1, 1, -1, 3, -1, 3, -3, 5,...) = (1, A186422).

%C Second differences: (0, 0, -2, 4, -4, 4, -6, 8, ...) = (-1)^(n+1) * A201629(n).

%C Interleave the terms with even indices of the companion A215495 and this one to get (A215495(0), A212831(0), A215495(2), A212831(2),...) = (1, 0, 1, 2, 3, 2, 3, 4, 5, 4,...) = A106249, up to the initial term = A083219 = A083220/2.

%H G. C. Greubel, <a href="/A212831/b212831.txt">Table of n, a(n) for n = 0..10000</a>

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

%F a(n) + A215495(n) = A043547(n).

%F a(n) = -A214283(n)/A000108([n/2]).

%F a(n+1) = (A186421(n)=0,1,2,1,4,...) + 1.

%F a(2*n) = A052928(n+1).

%F a(n+2) - a(n) = 2, 2, 0, 2. (period 4).

%F a(n) = a(n-2) +a(n-4) -a(n-6); also holds for A215495(n).

%F G.f.: x*(1+2*x+2*x^2+x^4) / ( (x^2+1)*(x-1)^2*(1+x)^2 ). - _R. J. Mathar_, Aug 21 2012

%F a(n) = (1/4)*((1 +(-1)^n)*(1 - (-1)^floor(n/2)) + (3 -(-1)^n)*n). - _G. C. Greubel_, Apr 25 2018

%t a[n_] := (1/4)*((-(1 + (-1)^n))*(-1 + (-1)^Floor[n/2]) - (-3 + (-1)^n)*n ); Table[a[n], {n, 0, 84}] (* _Jean-François Alcover_, Sep 18 2012 *)

%t LinearRecurrence[{0,1,0,1,0,-1},{0,1,2,3,2,5},80] (* _Harvey P. Dale_, May 29 2016 *)

%o (PARI) A212831(n)=if(bittest(n,0), n, n\2+bittest(n,1)) \\ _M. F. Hasler_, Oct 21 2012

%o (PARI) for(n=0,50, print1((1/4)*((1 +(-1)^n)*(1 - (-1)^floor(n/2)) + (3 -(-1)^n)*n), ", ")) \\ _G. C. Greubel_, Apr 25 2018

%o (Magma) [(1/4)*((1 +(-1)^n)*(1 - (-1)^Floor(n/2)) + (3 -(-1)^n)*n): n in [0..50]]; // _G. C. Greubel_, Apr 25 2018

%Y Cf. A214282, A129756.

%K nonn,easy

%O 0,3

%A _Paul Curtz_, Aug 14 2012

%E Corrected and edited by _M. F. Hasler_, Oct 21 2012