login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A271478 If n is even, a(n)=n/2, otherwise 2*n+2. 3

%I #13 Dec 07 2019 12:18:28

%S 0,4,1,8,2,12,3,16,4,20,5,24,6,28,7,32,8,36,9,40,10,44,11,48,12,52,13,

%T 56,14,60,15,64,16,68,17,72,18,76,19,80,20,84,21,88,22,92,23,96,24,

%U 100,25,104,26,108,27,112,28,116,29,120,30,124,31,128,32,132,33,136,34,140,35

%N If n is even, a(n)=n/2, otherwise 2*n+2.

%C Arises in studying A266569.

%H Colin Barker, <a href="/A271478/b271478.txt">Table of n, a(n) for n = 0..1000</a>

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

%F From _Colin Barker_, Apr 11 2016: (Start)

%F a(n) = 2*a(n-2)-a(n-4) for n>3.

%F G.f.: x*(4+x) / ((1-x)^2*(1+x)^2).

%F (End)

%F a(n) = (5*n - (-1)^n*(3*n + 4) + 4)/4. - _Ilya Gutkovskiy_, Apr 11 2016

%p f:=n->if n mod 2 = 0 then n/2 else 2*n+2; fi;

%p [seq(f(n),n=0..100)];

%t Table[(5 n - (-1)^n (3 n + 4) + 4)/4, {n, 0, 70}] \\ _Ilya Gutkovskiy_, Apr 11 2016

%o (PARI) concat(0, Vec(x*(4+x)/((1-x)^2*(1+x)^2) + O(x^50))) \\ _Colin Barker_, Apr 11 2016

%o (PARI) a(n) = if (n % 2, 2*n+2, n/2); \\ _Michel Marcus_, Apr 11 2016

%o (Python)

%o for n in range(0,10**3):

%o if(not n%2):print((int)(n/2))

%o else:print(2*n+2)

%o # _Soumil Mandal_, Apr 11 2016

%Y Cf. A266569, A271479.

%K nonn,easy

%O 0,2

%A _N. J. A. Sloane_, Apr 10 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)