title: Eulers Criterion Check If Square Root Under Modulo P Exists
signature: eulers_criterion_check_if_square_root_under_modulo_p_exists <- function(n, p) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, p, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n, p), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          71L, 78L, 
          FALSE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          85L, 75L, 
          FALSE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          4L, 35L, 
          TRUE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          20L, 99L, 
          FALSE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          71L, 29L, 
          TRUE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          72L, 88L, 
          FALSE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          36L, 54L, 
          TRUE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          95L, 52L, 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          83L, 33L, 
          FALSE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          72L, 13L, 
          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;
  }