login
a(n) = +-1 == ((p - 1)/2)! (mod p), where p is the n-th prime number == 3 (mod 4).
1

%I #36 Sep 05 2018 09:56:19

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

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

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

%N a(n) = +-1 == ((p - 1)/2)! (mod p), where p is the n-th prime number == 3 (mod 4).

%C By Wilson's theorem, ((p - 1)/2)!^2 == (-1)^((p + 1)/2) (mod p) for each prime number p. Hence, if p == 3 (mod 4), then ((p - 1)/2)! == +-1 (mod p).

%C Michele Elia proved that a(n) = (-1)^((1 + h(-p)) / 2) for n > 1, where p is the n-th prime number == 3 (mod 4), and h(-p) is the class number of the quadratic field Q(sqrt(-p)).

%C Mordell (1961) proved the same result 52 years earlier in a 2-page note in the Monthly. - _Jonathan Sondow_, Apr 09 2017

%H Robert Israel, <a href="/A265643/b265643.txt">Table of n, a(n) for n = 1..10000</a>

%H Michele Elia, <a href="http://dx.doi.org/10.12988/imf.2013.310193">A note on the sequence ((p-1)/2)! mod p</a>, International Mathematical Forum, 2013, Vol. 8, no. 37, pages 1813-1825.

%H L.J. Mordell, <a href="http://www.jstor.org/stable/2312481">The congruence (p-1/2)! == +-1 (mod p)</a>, Amer. Math. Monthly, 68 (1961), 145-146.

%e The second prime number == 3 (mod 4) is 7. Since ((7 - 1)/2)! = 3! = 6 == -1 (mod 7), it follows that a(2) = -1.

%p map(p -> if isprime(p) then mods(((p-1)/2)!, p) fi, [seq(i,i=3..10000, 4)]); # _Robert Israel_, Dec 11 2015

%t Function[p, Mod[((p-1)/2)!, p, -1]] /@ Select[Range[3, 2003, 4], PrimeQ] (* _Jean-François Alcover_, Feb 27 2016 *)

%Y Cf. A000924, A002145, A004055.

%K sign

%O 1,1

%A _Carlo Sanna_, Dec 11 2015