Function to return the largest prime number with d digits
static int largestPrime ( int d ) { int l = ( int ) Math . Pow ( 10 , d - 1 ) ; int r = ( int ) Math . Pow ( 10 , d ) - 1 ; for ( int i = r ; i >= l ; i -- ) {