OFFSET
1,2
COMMENTS
Numbers k such that k*(k + 3)/4 + (k + 1)*(k + 2)/6 or k*(5*k + 3)/12 + 1/3 is a nonnegative integer. - Bruno Berselli, Feb 14 2017
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-1).
FORMULA
a(n) = 3*n - 3 + (-1)^floor((n-1)/2).
From Wesley Ivan Hurt, Jun 07 2016: (Start)
G.f.: x*(1 + 2*x - x^2 + 4*x^3)/((1 - x)^2*(1 + x^2)).
a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) for n>4.
a(n) = (1 + i)*(3*(n - n*i + i - 1) + i^(1-n) - i^n)/2, where i=sqrt(-1).
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/6 + log(2)/2. - Amiram Eldar, Dec 31 2021
MAPLE
seq(3*n +(-1)^floor(n/2), n=0..50);
MATHEMATICA
Table[(1+I)*(3*(n-n*I+I-1)+I^(1-n)-I^n)/2, {n, 60}] (* Wesley Ivan Hurt, Jun 07 2016 *)
Select[Range[200], MemberQ[{1, 4, 5, 8}, Mod[#, 12]]&] (* or *) LinearRecurrence[ {2, -2, 2, -1}, {1, 4, 5, 8}, 60] (* Harvey P. Dale, Aug 02 2020 *)
PROG
(Magma) [n : n in [0..200] | n mod 12 in [1, 4, 5, 8]]; // Wesley Ivan Hurt, Jun 07 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gary Detlefs, Mar 18 2010
STATUS
approved