%I #46 Sep 08 2022 08:45:06
%S 0,-3,5,-7,-11,13,17,-19,-23,29,-31,37,41,-43,-47,53,-59,61,-67,-71,
%T 73,-79,-83,89,97,101,-103,-107,109,113,-127,-131,137,-139,149,-151,
%U 157,-163,-167,173,-179,181,-191,193,197,-199,-211,-223,-227,229,233,-239
%N Signed primes: if prime(n) even, a(n) = 0; if prime(n) == 1 (mod 4), a(n) = prime(n); if prime(n) == -1 (mod 4), a(n) = -prime(n).
%C Product_{i>1} (1/(1 - 1/a(i))) = 1 - 1/3 + 1/5 - 1/7 - 1/9 + 1/11 ...
%C = (Pi/4)*Product_{i>1} (1/(1 + 1/a(i)))
%C = (Pi/2)*Product_{i>1} (1/(1 - 1/a(i)))*Product_{i>1} (1/(1 + 1/a(i)))
%C = Product_{i>1} (1/(1 - 1/prime(i)^2))
%C = 1 + 1/3^2 + 1/5^2 + 1/7^2 + 1/9^2 + ...
%C = Pi^2/8.
%C Also prime(n)*(2 - prime(n) mod 4) = A000040(n)*A070750(n). - _Reinhard Zumkeller_, Oct 21 2002
%C This is a signed version of A160656. - _T. D. Noe_, Feb 28 2012
%H Reinhard Zumkeller, <a href="/A073579/b073579.txt">Table of n, a(n) for n = 1..10000</a>
%F a(1)=0 and for i>1: a(i) = (-1)^((prime(i)-1)/2)*prime(i).
%e a(1) = 0 because prime(1)=2 is neither 4k+1 nor 4k-1.
%e a(6) = 13 = prime(6) because 13 = 4*3 + 1.
%e a(8) = -19 = -prime(8) because 19 = 4*5 - 1.
%p 0, seq(I^(ithprime(n)-1)*ithprime(n), n = 2..100); # _G. C. Greubel_, Dec 31 2019
%t Join[{0},If[Mod[#,4]==1,#,-#]&/@Prime[Range[2,60]]] (* _Harvey P. Dale_, Feb 27 2012 *)
%t Join[{0}, Table[p = Prime[n]; If[Mod[p, 4] == 1, p, -p], {n, 2, 100}]] (* _T. D. Noe_, Feb 28 2012 *)
%o (Haskell)
%o a073579 n = p * (2 - p `mod` 4) where p = a000040 n
%o -- _Reinhard Zumkeller_, Feb 28 2012
%o (PARI) forprime(p=2,239,print1(p*(2-p%4),", ")) \\ _Hugo Pfoertner_, Dec 17 2019
%o (Magma) C<i> := ComplexField(); [0] cat [Round(i^(NthPrime(n)-1)*NthPrime(n)): n in [2..100]]; // _G. C. Greubel_, Dec 31 2019
%o (Sage) [0]+[I^(nth_prime(n)-1)*nth_prime(n) for n in (2..100)] # _G. C. Greubel_, Dec 31 2019
%Y Cf. A000040, A160656, A111003 (Pi^2/8).
%K easy,sign
%O 1,2
%A _Miklos Kristof_, Aug 28 2002
%E Corrected (sign changed on 179) by _Harvey P. Dale_, Feb 27 2012
|