OFFSET
1,2
COMMENTS
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.
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).
Also, the arithmetic function uhat(n,4,4) as defined in A291041. - Robert Price, Aug 25 2017
REFERENCES
I. S. Gradstein and I. M. Ryshik, Tables of series, products, and integrals, Volume 1, Verlag Harri Deutsch, 1981.
LINKS
Index entries for linear recurrences with constant coefficients, signature (-1,-1,-1).
FORMULA
a(n) = 1 if n is odd, and a(n) = -(1-(-1)^(n/2)) if n is even.
a(n+4*k) = a(n), n = 1, 2, 3, 4, k >= 1.
G.f.: -2*x/(1-x^4) + 1/(1-x^2) = (1-x)/((1+x)*(1+x^2)).
a(n) = Product_{k=1..n-1} 2*cos(2*k*Pi/n).
a(n) = sqrt(n^2 mod 8)*(-1)^(n+1). - Wesley Ivan Hurt, Jan 01 2014
From Wesley Ivan Hurt, Jun 22 2015: (Start)
a(n) + a(n-1) + a(n-2) + a(n-3) = 0, n>3.
a(n) = (1+(-1)^n)*(-1)^(n/2)/2-(-1)^n. (End)
From Wesley Ivan Hurt, Jul 09 2016: (Start)
a(n) = a(n-4) for n>4.
a(n) = cos(n*Pi/2) - (-1)^n. (End)
E.g.f.: cos(x) - exp(-x). - Ilya Gutkovskiy, Jul 09 2016
From Werner Schulte, Aug 29 2020: (Start)
Multiplicative with a(2^e) = (-2)^e if e<2 and 0 if e>1, and a(p^e) = 1 for prime p > 2.
Dirichlet g.f.: zeta(s) * (1-2^(-s)) * (1-2^(1-s)).
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)
MAPLE
MATHEMATICA
Table[Sqrt[Mod[n^2, 8]](-1)^(n+1), {n, 100}] (* Wesley Ivan Hurt, Jan 01 2014 *)
PadRight[{}, 120, {1, -2, 1, 0}] (* Harvey P. Dale, Apr 17 2014 *)
PROG
(Magma) &cat [[1, -2, 1, 0]^^30]; // Wesley Ivan Hurt, Jul 09 2016
(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
CROSSREFS
KEYWORD
sign,easy,mult
AUTHOR
Wolfdieter Lang, Oct 21 2013
STATUS
approved