title: Count Digits Factorial Set 2
signature: count_digits_factorial_set_2 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          56L, 
          75L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          92L, 
          143L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          52L, 
          68L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          96L, 
          150L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          96L, 
          150L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          63L, 
          88L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          51L, 
          67L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          79L, 
          117L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          70L, 
          101L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          9L, 
          6L
      )))
  
  }
  
  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;
  }