%I #16 Aug 23 2015 21:18:44
%S 0,-1,1,1,0,-1,1,0,-1,-1,0,1,0,0,1,1,0,0,1,0,-1,-1,0,1,0,0,1,0,0,-1,1,
%T 0,0,-1,0,1,-1,0,0,1,0,-1,0,0,-1,0,0,0,-1,0,1,1,0,-1,1,0,-1,0,0,0,0,0,
%U 0,1,0,-1,0,0,-1,-1,0,0,0,0,1,1,0,0,1,0,0,-1,0,1,0,0,1,0,0,-1,1,0,0,0,0,1,-1,0,1,1,0,0
%N a(n) = 1 if 2*n+1 is prime, otherwise a(n) = minimal residue of (-1)^binomial(n+2,2) mod (2n+1).
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/WilsonsTheorem.html">Wilson's Theorem</a>
%t Table[If[PrimeQ[2 n + 1], (-1)^Binomial[n + 2, 2], 0], {n, 0, 101}] (* _Michael De Vlieger_, Aug 22 2015 *)
%o (PARI) a(n) = if (isprime(2*n+1), ((-1)^ (binomial(n+2,2))), 0); \\ _Michel Marcus_, Aug 16 2015
%Y Apart from signs, same as A101264.
%K sign
%O 0,1
%A _Eric W. Weisstein_, Dec 12 2005
|