

A212831


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


6



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, 27, 14, 29, 16, 31, 16, 33, 18, 35, 18, 37, 20, 39, 20, 41, 22, 43, 22, 45, 24, 47, 24, 49, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

First differences: (1, 1, 1, 1, 3, 1, 3, 3, 5,...) = (1, A186422).
Second differences: (0, 0, 2, 4, 4, 4, 6, 8, ...) = (1)^(n+1) * A201629(n).
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.


LINKS

G. C. Greubel, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (0,1,0,1,0,1).


FORMULA

a(n) + A215495(n) = A043547(n).
a(n) = A214283(n)/A000108([n/2]).
a(n+1) = (A186421(n)=0,1,2,1,4,...) + 1.
a(2*n) = A052928(n+1).
a(n+2)  a(n) = 2, 2, 0, 2. (period 4).
a(n) = a(n2) +a(n4) a(n6); also holds for A215495(n).
G.f.: x*(1+2*x+2*x^2+x^4) / ( (x^2+1)*(x1)^2*(1+x)^2 ).  R. J. Mathar, Aug 21 2012
a(n) = (1/4)*((1 +(1)^n)*(1  (1)^floor(n/2)) + (3 (1)^n)*n).  G. C. Greubel, Apr 25 2018


MATHEMATICA

a[n_] := (1/4)*(((1 + (1)^n))*(1 + (1)^Floor[n/2])  (3 + (1)^n)*n ); Table[a[n], {n, 0, 84}] (* JeanFrançois Alcover, Sep 18 2012 *)
LinearRecurrence[{0, 1, 0, 1, 0, 1}, {0, 1, 2, 3, 2, 5}, 80] (* Harvey P. Dale, May 29 2016 *)


PROG

(PARI) A212831(n)=if(bittest(n, 0), n, n\2+bittest(n, 1)) \\ M. F. Hasler, Oct 21 2012
(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
(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


CROSSREFS

Cf. A214282, A129756.
Sequence in context: A182816 A195637 A181861 * A072969 A139712 A175856
Adjacent sequences: A212828 A212829 A212830 * A212832 A212833 A212834


KEYWORD

nonn,easy


AUTHOR

Paul Curtz, Aug 14 2012


EXTENSIONS

Corrected and edited by M. F. Hasler, Oct 21 2012


STATUS

approved



