login
A319006
Sum of the next n positive integers repeated (A008619).
2
1, 3, 8, 18, 34, 57, 89, 132, 187, 255, 338, 438, 556, 693, 851, 1032, 1237, 1467, 1724, 2010, 2326, 2673, 3053, 3468, 3919, 4407, 4934, 5502, 6112, 6765, 7463, 8208, 9001, 9843, 10736, 11682, 12682, 13737, 14849, 16020, 17251, 18543, 19898, 21318, 22804, 24357, 25979
OFFSET
1,2
FORMULA
G.f.: x*(1 - x + 3*x^2 - x^3 + x^4)/((1 + x^2)*(1 - x)^4).
a(n) = -a(-n) = 4*a(n-1) - 7*a(n-2) + 8*a(n-3) - 7*a(n-4) + 4*a(n-5) - a(n-6).
a(n) = (2*n*(n^2 + 2) + (1 - (-1)^n)*(-1)^((n-1)/2))/8.
a(n) = A319007(n) + n.
a(n) = (n^3 + 2*n + Chi(n))/4 where Chi(n) = A101455(n). - Peter Luschny, Sep 09 2018
EXAMPLE
Next n positive integers repeated: Sums:
1, ...................................... 1
1, 2, ................................... 3
2, 3, 3, ................................ 8
4, 4, 5, 5, ............................ 18
6, 6, 7, 7, 8, ........................ 34
8, 9, 9, 10, 10, 11, .................... 57, etc.
MAPLE
a := n -> (n^3 + 2*n + (-(n mod 2))^binomial(n, 2))/4:
seq(a(n), n=1..47); # Peter Luschny, Sep 09 2018
MATHEMATICA
Table[(2 n (n^2 + 2) + (1 - (-1)^n) (-1)^((n-1)/2))/8, {n, 1, 50}]
Module[{nn=50, lst}, lst=Flatten[Table[{n, n}, {n, (nn(nn+1))/2}]]; Total/@ TakeList[lst, Range[nn]]] (* Requires Mathematica version 11 or later *) (* or *) LinearRecurrence[{4, -7, 8, -7, 4, -1}, {1, 3, 8, 18, 34, 57}, 50] (* Harvey P. Dale, Jul 10 2021 *)
PROG
(Magma) [Integers()! (n*(n^2+2)+(-(n mod 2))^(n*(n-1)/2))/4: n in [1..50]];
(PARI) Vec(x*(1 - x + 3*x^2 - x^3 + x^4)/((1 + x^2)*(1 - x)^4) + O(x^50)) \\ Colin Barker, Sep 10 2018
CROSSREFS
Sum of the next n positive integers: A006003 (after 0).
Sequence in context: A184636 A075342 A083726 * A212589 A367188 A081489
KEYWORD
nonn,easy
AUTHOR
Bruno Berselli, Sep 07 2018
STATUS
approved