A112030 a(n) = (2 + (-1)^n) * (-1)^floor(n/2).
3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1, -3, -1, 3, 1
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,-1).
Programs
-
Maple
A112030 := proc(n) (2 + (-1)^n) * (-1)^floor(n/2) ; end proc: # R. J. Mathar, Jul 09 2013
-
Mathematica
LinearRecurrence[{0, -1}, {3, 1}, 100] (* Jean-François Alcover, Nov 24 2020 *)
-
PARI
a(n)=[3,1,-3,-1][n%4+1] \\ Charles R Greathouse IV, Aug 21 2011
-
Python
def A112030(n): return (3, 1, -3, -1)[n&3] # Chai Wah Wu, Jan 31 2023
Formula
a(n) = A010684(n+1) * (-1)^floor(n/2).
O.g.f.: (3+x)/(1+x^2). - R. J. Mathar, Jan 09 2008
Comments