OFFSET
1,3
COMMENTS
After 29, all terms are composite.
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (4,-7,8,-7,4,-1).
FORMULA
G.f.: x^2*(1 + x + x^2)/((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) = A319006(n) - n.
a(n) = (n^3 - 2*n + Chi(n))/4 where Chi(n) = A101455(n). - Peter Luschny, Sep 09 2018
EXAMPLE
Next n nonnegative integers repeated: Sums:
0, ...................................... 0
0, 1, ................................... 1
1, 2, 2, ................................ 5
3, 3, 4, 4, ............................. 14
5, 5, 6, 6, 7, .......................... 29
7, 8, 8, 9, 9, 10, ...................... 51, 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}]
PROG
(Magma) [Integers()! (n*(n^2-2)+(-(n mod 2))^(n*(n-1)/2))/4: n in [1..50]];
(PARI) concat(0, Vec(x^2*(1 + x + x^2)/((1 + x^2)*(1 - x)^4) + O(x^50))) \\ Colin Barker, Sep 10 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Bruno Berselli, Sep 07 2018
STATUS
approved