login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A256137 a(2) = 1; a(3) = 4; for n >= 4, a(n) = 2 + Sum_{i=4..n} d(i), where d(i) = i for even i, d(i) = i-3 for odd i. 1
1, 4, 6, 8, 14, 18, 26, 32, 42, 50, 62, 72, 86, 98, 114, 128, 146, 162, 182, 200, 222, 242, 266, 288, 314, 338, 366, 392, 422, 450, 482, 512, 546, 578, 614, 648, 686, 722, 762, 800, 842, 882, 926, 968, 1014, 1058, 1106, 1152, 1202, 1250, 1302, 1352, 1406 (list; graph; refs; listen; history; text; internal format)
OFFSET

2,2

LINKS

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

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

FORMULA

a(2) = 1; a(3) = 4; for n >= 4, a(n) = 2 + Sum_{i=4..n} d(i), where d(i) = i for even i, d(i) = i-3 for odd i.

From Colin Barker, Jul 12 2015 and Aug 20 2015: (Start)

a(n) = (5+3*(-1)^n-4*n+2*n^2)/4 for n>3.

a(n) = (n^2-2*n+4)/2 for n even and n>3.

a(n) = (n^2-2*n+1)/2 for n odd and n>3.

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

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

(End)

MATHEMATICA

Prepend[Table[2 + Sum[If[EvenQ@ i, i, i - 3], {i, 3, n}], {n, 3, 48}], 1] (* Michael De Vlieger, Jul 12 2015 *)

Join[{1, 2, 6, 8, 14, 18}, LinearRecurrence[{2, 0, -2, 1}, {26, 32, 42, 50}, 50]] (* Vincenzo Librandi, Jul 16 2015 *)

PROG

(PARI) a=4; print1("1, ", a, ", "); for (n=4, 100, if (Mod(n, 2)==0, d=n, d=n-3); a=a+d; print1(a, ", "))

(PARI) Vec(x^2*(2*x^5-5*x^4+2*x^3+2*x^2-2*x-1)/((x-1)^3*(x+1)) + O(x^100)) \\ Colin Barker, Jul 12 2015 and Aug 20 2015

(PARI) a(n)=if(n<3, 1, (n^2-2*n)\2+2-(n%2)) \\ Charles R Greathouse IV, Jul 17 2015

CROSSREFS

Sequence in context: A110974 A173180 A200077 * A116897 A293763 A246324

Adjacent sequences:  A256134 A256135 A256136 * A256138 A256139 A256140

KEYWORD

nonn,easy

AUTHOR

Kival Ngaokrajang, Jul 11 2015

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 April 6 22:23 EDT 2020. Contains 333291 sequences. (Running on oeis4.)