title: Prime Numbers
signature: function primeNumbers(n: number): boolean {
source_py: def prime_numbers(n):
      if (n <= 1):
          return False
      for i in range(2, n):
          if ((n % i) == 0):
              return False
      return True
source_cpp: bool prime_numbers(int n) {
    if ( n <= 1 ) return false;
    for ( int i = 2;
    i < n;
    i ++ ) if ( n % i == 0 ) return false;
    return true;
  }
question_info.test_list: [{"idx": 0, "outputs": true, "inputs": {"n": 2}}, {"idx": 1, "outputs": false, "inputs": {"n": 74}}, {"idx": 2, "outputs": false, "inputs": {"n": 46}}, {"idx": 3, "outputs": false, "inputs": {"n": 38}}, {"idx": 4, "outputs": false, "inputs": {"n": 51}}, {"idx": 5, "outputs": false, "inputs": {"n": 48}}, {"idx": 6, "outputs": false, "inputs": {"n": 6}}, {"idx": 7, "outputs": false, "inputs": {"n": 14}}, {"idx": 8, "outputs": true, "inputs": {"n": 31}}, {"idx": 9, "outputs": false, "inputs": {"n": 10}}]
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, expected:boolean): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(2, true);
    console.log(`TEST-0...${result}`);
  
    result = driver(74, false);
    console.log(`TEST-1...${result}`);
  
    result = driver(46, false);
    console.log(`TEST-2...${result}`);
  
    result = driver(38, false);
    console.log(`TEST-3...${result}`);
  
    result = driver(51, false);
    console.log(`TEST-4...${result}`);
  
    result = driver(48, false);
    console.log(`TEST-5...${result}`);
  
    result = driver(6, false);
    console.log(`TEST-6...${result}`);
  
    result = driver(14, false);
    console.log(`TEST-7...${result}`);
  
    result = driver(31, true);
    console.log(`TEST-8...${result}`);
  
    result = driver(10, false);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: primeNumbers
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