%I #32 Sep 08 2022 08:46:06
%S 2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,
%T -1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,
%U 0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1,0,-1,2,1,0,1,-2,-1
%N Period 8: repeat [2, 1, 0, 1, -2, -1, 0, -1].
%C This is A118825(n+5), n >= 0. (The g.f. given there is not quite correct, because then a(0) = 0 but it should be 1.)
%C This sequence a(n), n >= 2, is product(2*cos((2*l+1)*Pi/2), l=0..floor((n-2)/2)). This is the unrestricted product which appears in the formula for C(n, 0) with the minimal polynomial C of rho(n):=2*cos(Pi/n) (see A187360), the length ratio (smallest diagonal)/side in the regular n-gon. The restriction gcd(2*l+1, n) = 1 is ineffective for n = 2^k, k>=1, and for n = odd prime p. Therefore norm(rho(n)) = (-1)^delta(n)*C(n, 0) with delta(n) (see A055034) the degree of C, can be computed from the present sequence for these two cases.
%H Muniru A Asiru, <a href="/A230075/b230075.txt">Table of n, a(n) for n = 0..2000</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,-1).
%F O.g.f.: (2 + x + x^3) / (1 + x^4).
%F a(n) = 2*(-1)^(n/4) if n == 0 (mod 4); a(n) == 0 if n == 2 (mod 4); a(n) = (-1)^((n-1)/4) if n == 1 (mod 4); a(n) == (-1)^((n-3)/4) if n == 3 (mod 4).
%F a(n) = Product_{l=0..floor((n-2)/2)} 2*cos((2*l+1)*Pi/2). Proof via the product formulas for the four (mod 4) cases; see the comments for subsequences like A033999, and the product of the zeros of Chebyshev S-polynomials (A049310) from S(n-1, 0) which is known.
%F a(n) = sqrt((n+2)^2 mod 8)*(-1)^floor(n/4). - _Wesley Ivan Hurt_, Jan 01 2014
%F a(n) = (cos(Pi*(2*n+q-r-s)/8)-cos(Pi*(-2*n+q+r-s)/8)+sin(Pi*(-2*n+q-r+s)/8)+3*sin(Pi*(2*n+q+r+s)/8))/2 where q = 1+(-1)^n, r = 2*sin(n*Pi/2) and s = 2*cos(n*Pi/2). - _Wesley Ivan Hurt_, Oct 06 2018
%p A230075:=n->sqrt((n+2)^2 mod 8)*(-1)^floor(n/4); seq(A230075(n), n=0..100); # _Wesley Ivan Hurt_, Jan 01 2014
%t Table[Sqrt[Mod[(n+2)^2, 8]](-1)^Floor[n/4], {n, 0, 100}] (* _Wesley Ivan Hurt_, Jan 01 2014 *)
%o (PARI) a(n)=[2, 1, 0, 1, -2, -1, 0, -1][n%8+1] \\ _Charles R Greathouse IV_, Jul 17 2016
%o (GAP) Flat(List([1..15],n->[2,1,0,1,-2,-1,0,-1])); # _Muniru A Asiru_, Oct 07 2018
%o (Magma) &cat [[2, 1, 0, 1, -2, -1, 0, -1]^^20]; // _Wesley Ivan Hurt_, Oct 10 2018
%Y Cf. A118825, A187360.
%K sign,easy
%O 0,1
%A _Wolfdieter Lang_, Oct 23 2013