title: Eulers Criterion Check If Square Root Under Modulo P Exists
signature: function eulersCriterionCheckIfSquareRootUnderModuloPExists(n: number, p: number): boolean {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": false, "inputs": {"n": 71, "p": 78}}, {"idx": 1, "outputs": false, "inputs": {"n": 85, "p": 75}}, {"idx": 2, "outputs": true, "inputs": {"n": 4, "p": 35}}, {"idx": 3, "outputs": false, "inputs": {"n": 20, "p": 99}}, {"idx": 4, "outputs": true, "inputs": {"n": 71, "p": 29}}, {"idx": 5, "outputs": false, "inputs": {"n": 72, "p": 88}}, {"idx": 6, "outputs": true, "inputs": {"n": 36, "p": 54}}, {"idx": 7, "outputs": false, "inputs": {"n": 95, "p": 52}}, {"idx": 8, "outputs": false, "inputs": {"n": 83, "p": 33}}, {"idx": 9, "outputs": false, "inputs": {"n": 72, "p": 13}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: boolean, expected: boolean): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, p: number, expected:boolean): string {
      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}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: eulersCriterionCheckIfSquareRootUnderModuloPExists
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js