title: Count Factorial Numbers In A Given Range
signature: function countFactorialNumbersInAGivenRange(low, high) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(low, high, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(low, high),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(57, 79, 0);
    console.log(`TEST-0...${result}`);
  
    result = driver(57, 21, 0);
    console.log(`TEST-1...${result}`);
  
    result = driver(31, 37, 0);
    console.log(`TEST-2...${result}`);
  
    result = driver(62, 87, 0);
    console.log(`TEST-3...${result}`);
  
    result = driver(49, 98, 0);
    console.log(`TEST-4...${result}`);
  
    result = driver(82, 76, 0);
    console.log(`TEST-5...${result}`);
  
    result = driver(31, 45, 0);
    console.log(`TEST-6...${result}`);
  
    result = driver(5, 52, 2);
    console.log(`TEST-7...${result}`);
  
    result = driver(76, 43, 0);
    console.log(`TEST-8...${result}`);
  
    result = driver(55, 6, 0);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
source_py: def count_factorial_numbers_in_a_given_range(low, high):
      fact = 1
      x = 1
      while (fact < low):
          fact = (fact * x)
          x += 1
      res = 0
      while (fact <= high):
          res += 1
          fact = (fact * x)
          x += 1
      return res
source_cpp: int count_factorial_numbers_in_a_given_range(int low, int high) {
    int fact = 1, x = 1;
    while ( fact < low ) {
      fact = fact * x;
      x ++;
    }
    int res = 0;
    while ( fact <= high ) {
      res ++;
      fact = fact * x;
      x ++;
    }
    return res;
  }