title: Eulers Criterion Check If Square Root Under Modulo P Exists
signature: def eulersCriterionCheckIfSquareRootUnderModuloPExists(n: Int, p: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Boolean , expected: Boolean): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(n: Int, p: Int, expected: Boolean): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(n, p),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        71, 78, 
        false    
      )}")   
  
  
      println(s"TEST-1...${driver(
        85, 75, 
        false    
      )}")   
  
  
      println(s"TEST-2...${driver(
        4, 35, 
        true    
      )}")   
  
  
      println(s"TEST-3...${driver(
        20, 99, 
        false    
      )}")   
  
  
      println(s"TEST-4...${driver(
        71, 29, 
        true    
      )}")   
  
  
      println(s"TEST-5...${driver(
        72, 88, 
        false    
      )}")   
  
  
      println(s"TEST-6...${driver(
        36, 54, 
        true    
      )}")   
  
  
      println(s"TEST-7...${driver(
        95, 52, 
        false    
      )}")   
  
  
      println(s"TEST-8...${driver(
        83, 33, 
        false    
      )}")   
  
  
      println(s"TEST-9...${driver(
        72, 13, 
        false    
      )}")   
  
  }
  
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;
  }