title: Count Digits Factorial Set 2
signature: function countDigitsFactorialSet2(n) {
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(n, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(56, 75);
    console.log(`TEST-0...${result}`);
  
    result = driver(92, 143);
    console.log(`TEST-1...${result}`);
  
    result = driver(52, 68);
    console.log(`TEST-2...${result}`);
  
    result = driver(96, 150);
    console.log(`TEST-3...${result}`);
  
    result = driver(96, 150);
    console.log(`TEST-4...${result}`);
  
    result = driver(63, 88);
    console.log(`TEST-5...${result}`);
  
    result = driver(51, 67);
    console.log(`TEST-6...${result}`);
  
    result = driver(79, 117);
    console.log(`TEST-7...${result}`);
  
    result = driver(70, 101);
    console.log(`TEST-8...${result}`);
  
    result = driver(9, 6);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
source_py: def count_digits_factorial_set_2(n):
      if (n < 0):
          return 0
      if (n <= 1):
          return 1
      x = ((n * math.log10((n / math.e))) + (math.log10(((2 * math.pi) * n)) / 2.0))
      return (math.floor(x) + 1)
source_cpp: long long count_digits_factorial_set_2(int n) {
    if ( n < 0 ) return 0;
    if ( n <= 1 ) return 1;
    double x = ( ( n * log10 ( n / M_E ) + log10 ( 2 * M_PI * n ) / 2.0 ) );
    return floor ( x ) + 1;
  }