cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A271478 #16 Aug 13 2025 23:08:12
%S A271478 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 A271478 56,14,60,15,64,16,68,17,72,18,76,19,80,20,84,21,88,22,92,23,96,24,
%U A271478 100,25,104,26,108,27,112,28,116,29,120,30,124,31,128,32,132,33,136,34,140,35
%N A271478 If n is even, a(n)=n/2, otherwise 2*n+2.
%C A271478 Arises in studying A266569.
%H A271478 Colin Barker, <a href="/A271478/b271478.txt">Table of n, a(n) for n = 0..1000</a>
%H A271478 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,2,0,-1).
%F A271478 From _Colin Barker_, Apr 11 2016: (Start)
%F A271478 a(n) = 2*a(n-2)-a(n-4) for n>3.
%F A271478 G.f.: x*(4+x) / ((1-x)^2*(1+x)^2). (End)
%F A271478 a(n) = (5*n - (-1)^n*(3*n + 4) + 4)/4. - _Ilya Gutkovskiy_, Apr 11 2016
%p A271478 f:=n->if n mod 2 = 0 then n/2 else 2*n+2; fi;
%p A271478 [seq(f(n),n=0..100)];
%t A271478 Table[(5 n - (-1)^n (3 n + 4) + 4)/4, {n, 0, 70}] (* _Ilya Gutkovskiy_, Apr 11 2016 *)
%o A271478 (PARI) concat(0, Vec(x*(4+x)/((1-x)^2*(1+x)^2) + O(x^50))) \\ _Colin Barker_, Apr 11 2016
%o A271478 (PARI) a(n) = if (n % 2, 2*n+2, n/2); \\ _Michel Marcus_, Apr 11 2016
%o A271478 (Python)
%o A271478 for n in range(0,10**3):
%o A271478     if(not n%2):print((int)(n/2))
%o A271478     else:print(2*n+2)
%o A271478 # _Soumil Mandal_, Apr 11 2016
%Y A271478 Cf. A266569, A271479.
%K A271478 nonn,easy
%O A271478 0,2
%A A271478 _N. J. A. Sloane_, Apr 10 2016