OFFSET
2,2
COMMENTS
a(n)^2 == (-1)^((prime(n) + 1)/2) (mod prime(n)).
Use product(p-j,j=1..(p-1)/2) == (-1)^((p-1)/2)*a(n) (mod p) for p=prime(n), n>=2, hence a(n)*(-1)^((p-1)/2)*a(n) == (p-1)! (mod p), then apply Wilson's theorem. That is, a(n)^2 == -1 (mod prime(n)) for primes of the form 4*k+1 (see A002144) and +1 for primes of the form 4*k+3 (see A002145). See the link with a blog by W. Holsztyński.
See A004055 for a(n) (mod prime(n)), n>=2.
See A212159 for a(n)^2 (mod prime(n)), n>=2.
LINKS
Holsztyński Włodzimierz, Congruence x^2==-1 (mod p) (Euler), and a super-Wilson Theorem
EXAMPLE
a(4) = ((7-1)/2)! = 3! = 6.
a(4)^2 = 36 == +1 (mod 7), because (7 + 1)/2 = 4, and 4 is even.
a(6) = ((13-1)/2)! = 6! = 720.
a(6)^2 = 518400 == -1 (mod 13) = 12 (mod 13) because (13+1)/2 = 7, and 7 is odd.
MATHEMATICA
((Prime[Range[2, 20]]-1)/2))! (* Harvey P. Dale, Jan 24 2021 *)
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
Wolfdieter Lang, May 08 2012
STATUS
approved