Function to check if all a [ i ] [ j ] with prime ( i + j ) are prime
static boolean checkIndex ( int n , int m , int a [ ] [ ] ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) {