title: Count Digits Factorial Set 1
signature: func countDigitsFactorialSet1(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(66, 93)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(7, 4)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(55, 74)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(37, 44)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(76, 112)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(16, 14)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(17, 15)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(95, 149)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(71, 102)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(90, 139)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def count_digits_factorial_set_1(n):
      if (n < 0):
          return 0
      if (n <= 1):
          return 1
      digits = 0
      for i in range(2, (n + 1)):
          digits += math.log10(i)
      return (math.floor(digits) + 1)
source_cpp: int count_digits_factorial_set_1(int n) {
    if ( n < 0 ) return 0;
    if ( n <= 1 ) return 1;
    double digits = 0;
    for ( int i = 2;
    i <= n;
    i ++ ) digits += log10 ( i );
    return floor ( digits ) + 1;
  }