title: Eulers Criterion Check If Square Root Under Modulo P Exists
signature: function eulersCriterionCheckIfSquareRootUnderModuloPExists(n, p) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(n, p, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n, p),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(71, 78, false);
    console.log(`TEST-0...${result}`);
  
    result = driver(85, 75, false);
    console.log(`TEST-1...${result}`);
  
    result = driver(4, 35, true);
    console.log(`TEST-2...${result}`);
  
    result = driver(20, 99, false);
    console.log(`TEST-3...${result}`);
  
    result = driver(71, 29, true);
    console.log(`TEST-4...${result}`);
  
    result = driver(72, 88, false);
    console.log(`TEST-5...${result}`);
  
    result = driver(36, 54, true);
    console.log(`TEST-6...${result}`);
  
    result = driver(95, 52, false);
    console.log(`TEST-7...${result}`);
  
    result = driver(83, 33, false);
    console.log(`TEST-8...${result}`);
  
    result = driver(72, 13, false);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    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;
  }