Implementation of Wilson Primality test | C # implementation to check if a number is prime or not using Wilson Primality Test ; Function to calculate the factorial ; Function to check if the number is prime or not ; Driver code
using System ; class GFG { static long fact ( int p ) { if ( p <= 1 ) return 1 ; return p * fact ( p - 1 ) ; } static long isPrime ( int p ) { if ( p == 4 ) return 0 ; return ( fact ( p >> 1 ) % p ) ; } static void Main ( ) { if ( isPrime ( 127 ) == 0 ) { Console . WriteLine ( 0 ) ; } else { Console . WriteLine ( 1 ) ; } } } }