title: Eulers Criterion Check If Square Root Under Modulo P Exists
signature: function eulersCriterionCheckIfSquareRootUnderModuloPExists($n, $p) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($n, $p, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n, $p), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        71, 78, 
        false));
      
      printf("TEST-1...%s\n",driver(
        85, 75, 
        false));
      
      printf("TEST-2...%s\n",driver(
        4, 35, 
        true));
      
      printf("TEST-3...%s\n",driver(
        20, 99, 
        false));
      
      printf("TEST-4...%s\n",driver(
        71, 29, 
        true));
      
      printf("TEST-5...%s\n",driver(
        72, 88, 
        false));
      
      printf("TEST-6...%s\n",driver(
        36, 54, 
        true));
      
      printf("TEST-7...%s\n",driver(
        95, 52, 
        false));
      
      printf("TEST-8...%s\n",driver(
        83, 33, 
        false));
      
      printf("TEST-9...%s\n",driver(
        72, 13, 
        false));
      
  }
  
  main();
  ?>
source_py: def eulers_criterion_check_if_square_root_under_modulo_p_exists(n, p):
      n = (n % p)
      for x in range(2, p, 1):
          if (((x * x) % p) == n):
              return True
      return False
source_cpp: bool eulers_criterion_check_if_square_root_under_modulo_p_exists(int n, int p) {
    n = n % p;
    for ( int x = 2;
    x < p;
    x ++ ) if ( ( x * x ) % p == n ) return true;
    return false;
  }