OFFSET
0,3
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (3,-4,3,-1).
FORMULA
a(
G.f.: (1-2*x+3*x^2-x^3)/((1-x+x^2)*(1-x)^2). - Robert Israel, Nov 02 2014
a(n) = n iff n is either 1 or 2 mod 6. - Jon Perry, Nov 02 2014
a(n) = n + 1 - ((-1)^floor((n-1)/3) + (-1)^floor(n/3))/2) = n + 1 - A010892(n+5). - G. C. Greubel, Jul 24 2019
For k >= 1, a(6*k-1) = a(6*k) = a(6*k+1) = 6*k+1; a(6*k+2) = 6*k+2; a(6*k+3) = 6*k+4; a(6*k+4) = 6*k+6. - Bernard Schott, Jul 24 2019
a(n) = 3*a(n-1) - 4*a(n-2) + 3*a(n-3) - a(n-4) for n > 3. - Chai Wah Wu, Jun 30 2020
MAPLE
A:= gfun:-rectoproc({a(n)=a(n-1)-a(n-2)+n , a(0)=1, a(1)=1}, a(n), remember):
seq(A(n), n=0..80); # Robert Israel, Nov 02 2014
MATHEMATICA
Table[n+1 -((-1)^Floor[(n-1)/3] +(-1)^Floor[n/3])/2, {n, 0, 80}] (* G. C. Greubel, Jul 24 2019 *)
PROG
(Sage) [lucas_number1(n+1, 2, 1)-lucas_number1(n, 1, 1) for n in range(0, 80)] # Zerinvary Lajos, Nov 10 2009
(Magma) [1] cat [n le 2 select (n) else n + Self(n-1)-Self(n-2): n in [1..80]]; // Vincenzo Librandi, Nov 02 2014
(PARI) vector(80, n, n--; n+1 - ((-1)^floor((n-1)/3) + (-1)^floor(n/3))/2) \\ G. C. Greubel, Jul 24 2019
(GAP) Concatenation([1], List([1..80], n-> n+1 - ((-1)^Int((n-1)/3) + (-1)^Int(n/3))/2 )); # G. C. Greubel, Jul 24 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
More terms from Erich Friedman
STATUS
approved