OFFSET
0,3
COMMENTS
Sequence extended to left:
..., 36, 29, 21, 16, 10, 6, 3, 1, 0, 0, 1, 2, 6, 9, 15, 20, 28, 34, ...,
where 0, 1, 3, 6, 10, 16, 21, 29, 36, 46, ... is A260708.
After 2, if a(n) is prime then n == 4 (mod 6).
a(n) is a square for n = 0, 1, 4, 49, 52, 192, 1681, 4948, 57121, 60388, 221952, 1940449, 5710372, ...
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,1,-1,0,0,1,-1,-1,1).
FORMULA
G.f.: x*(1 + x + 3*x^2 + 2*x^3 + 2*x^4 + 2*x^5 + x^6)/((1 - x)^3*(1 + x)^2*(1 - x + x^2)*(1 + x + x^2)).
a(n) = a(n-1) + a(n-2) - a(n-3) + a(n-6) - a(n-7) - a(n-8) + a(n-9).
a(2*k+1) = A000217(2*k+1) by definition; for even indices:
a(6*k) = 2*k*(9*k + 1),
a(6*k+2) = 2*(9*k^2 + 7*k + 1),
a(6*k+4) = 18*k^2 + 26*k + 9.
a(n) = n*(n + 1)/2 - (1 + (-1)^n)*floor(n/6 + 2/3)/2. [Bruno Berselli, Nov 18 2015]
EXAMPLE
a(0) = 0,
a(1) = 1*1 = 1,
a(2) = 2,
a(3) = 2*3 = 6,
a(4) = 9,
a(5) = 3*5 = 15,
a(6) = a(0) + 12*0 + 20 = 20, etc.
MATHEMATICA
LinearRecurrence[{1, 1, -1, 0, 0, 1, -1, -1, 1}, {0, 1, 2, 6, 9, 15, 20, 28, 34}, 50] (* Bruno Berselli, Nov 18 2015 *)
PROG
(Magma) [n*(n+1)/2-(1+(-1)^n)*Floor(n/6+2/3)/2: n in [0..50]]; // Bruno Berselli, Nov 18 2015
(Sage) [n*(n+1)/2-(1+(-1)^n)*floor(n/6+2/3)/2 for n in (0..50)] # Bruno Berselli, Nov 18 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Nov 16 2015
EXTENSIONS
Edited by Bruno Berselli, Nov 17 2015
STATUS
approved