title: Count Digits Factorial Set 2
signature: function countDigitsFactorialSet2($n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        56, 
        75));
      
      printf("TEST-1...%s\n",driver(
        92, 
        143));
      
      printf("TEST-2...%s\n",driver(
        52, 
        68));
      
      printf("TEST-3...%s\n",driver(
        96, 
        150));
      
      printf("TEST-4...%s\n",driver(
        96, 
        150));
      
      printf("TEST-5...%s\n",driver(
        63, 
        88));
      
      printf("TEST-6...%s\n",driver(
        51, 
        67));
      
      printf("TEST-7...%s\n",driver(
        79, 
        117));
      
      printf("TEST-8...%s\n",driver(
        70, 
        101));
      
      printf("TEST-9...%s\n",driver(
        9, 
        6));
      
  }
  
  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;
  }