login
Period 4: repeat [1, -2, 1, 0].
1

%I #47 Sep 08 2022 08:46:06

%S 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,

%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,0,1,

%U -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

%N Period 4: repeat [1, -2, 1, 0].

%C The o.g.f. for this sequence is obtained from the o.g.f.'s of the bisection of the sequence including a(0) = 0.

%C For the cos product formula below use Product_{k=1..n-1} 2*cos(2*k*Pi/n) = 1 if n is odd, and Product_{k=1..n-1} 2*cos(2*k*Pi/n) = -(1-(-1)^(n/2)) if n is even (see Gradstein-Rhyzik, p.62, 1.393 1., with x=0).

%C Also, the arithmetic function uhat(n,4,4) as defined in A291041. - _Robert Price_, Aug 25 2017

%D I. S. Gradstein and I. M. Ryshik, Tables of series, products, and integrals, Volume 1, Verlag Harri Deutsch, 1981.

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (-1,-1,-1).

%F a(n) = 1 if n is odd, and a(n) = -(1-(-1)^(n/2)) if n is even.

%F a(n+4*k) = a(n), n = 1, 2, 3, 4, k >= 1.

%F G.f.: -2*x/(1-x^4) + 1/(1-x^2) = (1-x)/((1+x)*(1+x^2)).

%F a(n) = Product_{k=1..n-1} 2*cos(2*k*Pi/n).

%F a(n) = sqrt(n^2 mod 8)*(-1)^(n+1). - _Wesley Ivan Hurt_, Jan 01 2014

%F From _Wesley Ivan Hurt_, Jun 22 2015: (Start)

%F a(n) + a(n-1) + a(n-2) + a(n-3) = 0, n>3.

%F a(n) = (1+(-1)^n)*(-1)^(n/2)/2-(-1)^n. (End)

%F From _Wesley Ivan Hurt_, Jul 09 2016: (Start)

%F a(n) = a(n-4) for n>4.

%F a(n) = cos(n*Pi/2) - (-1)^n. (End)

%F E.g.f.: cos(x) - exp(-x). - _Ilya Gutkovskiy_, Jul 09 2016

%F From _Werner Schulte_, Aug 29 2020: (Start)

%F Multiplicative with a(2^e) = (-2)^e if e<2 and 0 if e>1, and a(p^e) = 1 for prime p > 2.

%F Dirichlet g.f.: zeta(s) * (1-2^(-s)) * (1-2^(1-s)).

%F Dirichlet inverse b(n) is multiplicative with b(2^e) = 2^e and, for prime p>2, b(p^e) = (-1)^e if e<2 and 0 if e>1. (End)

%p A230074:=n->sqrt(n^2 mod 8)*(-1)^(n+1); seq(A230074(n), n=1..100); # _Wesley Ivan Hurt_, Jan 01 2014

%t Table[Sqrt[Mod[n^2, 8]](-1)^(n+1), {n, 100}] (* _Wesley Ivan Hurt_, Jan 01 2014 *)

%t PadRight[{},120,{1,-2,1,0}] (* _Harvey P. Dale_, Apr 17 2014 *)

%o (Magma) &cat [[1, -2, 1, 0]^^30]; // _Wesley Ivan Hurt_, Jul 09 2016

%o (PARI) a(n)=([0,1,0; 0,0,1; -1,-1,-1]^(n-1)*[1;-2;1])[1,1] \\ _Charles R Greathouse IV_, Jul 17 2016

%Y Cf. A291041.

%K sign,easy,mult

%O 1,2

%A _Wolfdieter Lang_, Oct 21 2013