title: Count Digits Factorial Set 2
signature: class Solution {
  
      public Integer countDigitsFactorialSet2(Integer n) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(56, 75);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(92, 143);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(52, 68);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(96, 150);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(96, 150);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(63, 88);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(51, 67);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(79, 117);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(70, 101);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(9, 6);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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;
  }