title: Count Digits Factorial Set 2
signature: func countDigitsFactorialSet2(n int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(56, 75)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(92, 143)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(52, 68)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(96, 150)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(96, 150)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(63, 88)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(51, 67)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(79, 117)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(70, 101)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(9, 6)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }