Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #30 Jan 31 2023 16:10:01
%S 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,
%T -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,
%U -3,-1,3,1,-3,-1,3,1,-3,-1,3,1,-3,-1,3,1,-3,-1,3,1,-3,-1,3,1
%N a(n) = (2 + (-1)^n) * (-1)^floor(n/2).
%C The fractions A112031(n)/A112032(n) give the partial sums of a(n)/floor((n+4)/2).
%C Sum of the two Cartesian coordinates from the image of the point (2,1) after n 90-degree counterclockwise rotations about the origin. - _Wesley Ivan Hurt_, Jul 06 2013
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,-1).
%F a(n) = A010684(n+1) * (-1)^floor(n/2).
%F O.g.f.: (3+x)/(1+x^2). - _R. J. Mathar_, Jan 09 2008
%p A112030 := proc(n)
%p (2 + (-1)^n) * (-1)^floor(n/2) ;
%p end proc: # _R. J. Mathar_, Jul 09 2013
%t LinearRecurrence[{0, -1}, {3, 1}, 100] (* _Jean-François Alcover_, Nov 24 2020 *)
%o (PARI) a(n)=[3,1,-3,-1][n%4+1] \\ _Charles R Greathouse IV_, Aug 21 2011
%o (Python)
%o def A112030(n): return (3, 1, -3, -1)[n&3] # _Chai Wah Wu_, Jan 31 2023
%Y Cf. A010684, A016116, A112031, A112032, A112033.
%K sign,easy
%O 0,1
%A _Reinhard Zumkeller_, Aug 27 2005