title: Eulers Criterion Check If Square Root Under Modulo P Exists
signature: class Solution {
  
      public Boolean eulersCriterionCheckIfSquareRootUnderModuloPExists(Integer n, Integer p) {
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.extension: java
question_info.entry_fn_name: eulersCriterionCheckIfSquareRootUnderModuloPExists
question_info.entry_cls_name: Solution
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.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer p, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n, p,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(71, 78, false);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(85, 75, false);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(4, 35, true);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(20, 99, false);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(71, 29, true);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(72, 88, false);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(36, 54, true);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(95, 52, false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(83, 33, false);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(72, 13, false);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer p, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n, p),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__