login
This site is supported by donations 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
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, 56, 14, 60, 15, 64, 16, 68, 17, 72, 18, 76, 19, 80, 20, 84, 21, 88, 22, 92, 23, 96, 24, 100, 25, 104, 26, 108, 27, 112, 28, 116, 29, 120, 30, 124, 31, 128, 32, 132, 33, 136, 34, 140, 35 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

COMMENTS

Arises in studying A266569.

LINKS

Colin Barker, Table of n, a(n) for n = 0..1000

Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).

FORMULA

From Colin Barker, Apr 11 2016: (Start)

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

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

(End)

a(n) = (5*n - (-1)^n*(3*n + 4) + 4)/4. - Ilya Gutkovskiy, Apr 11 2016

MAPLE

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

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

MATHEMATICA

Table[(5 n - (-1)^n (3 n + 4) + 4)/4, {n, 0, 70}] \\ Ilya Gutkovskiy, Apr 11 2016

PROG

(PARI) concat(0, Vec(x*(4+x)/((1-x)^2*(1+x)^2) + O(x^50))) \\ Colin Barker, Apr 11 2016

(PARI) a(n) = if (n % 2, 2*n+2, n/2); \\ Michel Marcus, Apr 11 2016

(Python)

for n in xrange(0, 10**3):

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

    else:print(2*n+2)

# Soumil Mandal, Apr 11 2016

CROSSREFS

Cf. A266569, A271479.

Sequence in context: A134829 A245966 A130297 * A112032 A199049 A145917

Adjacent sequences:  A271475 A271476 A271477 * A271479 A271480 A271481

KEYWORD

nonn,easy

AUTHOR

N. J. A. Sloane, Apr 10 2016

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 18 12:16 EST 2019. Contains 329261 sequences. (Running on oeis4.)