%I #56 Oct 08 2023 05:00:36
%S 0,-1,1,-1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,
%T -1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,1,-1,1,-1,
%U 1,-1,1,-1,1,1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1
%N 0 if n-th prime is even, 1 if n-th prime is == 1 (mod 4), and -1 if n-th prime is == 3 (mod 4).
%C Also, sin(prime(n)*Pi/2), where prime(n) = A000040(n), Pi=3.1415... (original definition).
%C Also imaginary part of primes mapped as defined in A076340, A076341: a(n) = A076341(A000040(n)), real part = A076342.
%C Legendre symbol (-1/prime(n)) for n > 1. - _T. D. Noe_, Nov 05 2003
%C For n > 1, let p = prime(n) and m = (p-1)/2. Then c(m) - a(n) == 0 (mod p), where c(m) = (2*m)!/(m!)^2 = A000984(m) is the central binomial coefficient. [Proof: By definition, c(m)*(m!)^2 - (p-1)! = 0 and therefore c(m)*(m!)^2*(-1)^(m+1) - (p-1)!*(-1)^(m+1) = 0. Now apply Wilson's theorem, (p-1)! == 1 (mod p), and its corollary, (m!)^2 == (-1)^(m+1) (mod p), and finally use the formula by _T. D. Noe_ listed below to replace (-1)^m with a(n).] Similarly, C_m - 2*a(n) == 0 (mod p), with C_m = A000108(m) being the m-th Catalan number. [Proof: By definition, C_m*(p+1)*(m!)^2 - 2*(p-1)! = 0. The result follows proceeding as in the first proof.] - _Stanislav Sykora_, Aug 11 2014
%H Reinhard Zumkeller, <a href="/A070750/b070750.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/LegendreSymbol.html">Legendre Symbol</a>.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Wilson%27s_theorem">Wilson's theorem</a>.
%F a(n) = 2 - prime(n) mod 4 = 2 - A039702(n).
%F a(n) = (-1)^((prime(n)-1)/2) for n > 1. - _T. D. Noe_, Nov 05 2003
%F From _Amiram Eldar_, Dec 24 2022: (Start)
%F Product_{n>=1} (1 - a(n)/prime(n)) = 4/Pi (A088538).
%F Product_{n>=1} (1 + a(n)/prime(n)) = 2/Pi (A060294). (End)
%e p = 4*k+1 (see A002144): a(p) = sin((4*k+1)*Pi/2) = sin(2*k*Pi + Pi/2) = sin(Pi/2) = 1.
%e p = 4*k+3 (see A002145): a(p) = sin((4*k+3)*Pi/2) = sin(2*k*Pi + 3*Pi/2) = sin(3*Pi/2) = -1.
%t a[n_] := JacobiSymbol[-1, Prime[n]]; a[1] = 0; Table[a[n], {n, 1, 72}] (* _Jean-François Alcover_, Oct 05 2012, after _T. D. Noe_ *)
%t Table[Which[EvenQ[p],0,Mod[p,4]==1,1,True,-1],{p,Prime[Range[80]]}] (* _Harvey P. Dale_, Mar 16 2020 *)
%o (PARI) apply(n->2-n%4,primes(100)) \\ _Charles R Greathouse IV_, Aug 21 2011
%o (Haskell)
%o a070750 = (2 -) . (`mod` 4) . a000040 -- _Reinhard Zumkeller_, Feb 28 2012
%Y Cf. A000040, A039702, A070748, A070749, A002144, A002145, A000108, A000984, A134323, A257834, A076340, A076341.
%Y Cf. A060294, A088538.
%K sign,nice,easy
%O 1,1
%A _Reinhard Zumkeller_, May 04 2002
%E Wording of definition changed by _N. J. A. Sloane_, Jun 21 2015