title: Count Digits Factorial Set 1
signature: count_digits_factorial_set_1 <- 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(
          66L, 
          93L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          7L, 
          4L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          55L, 
          74L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          37L, 
          44L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          76L, 
          112L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          16L, 
          14L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          17L, 
          15L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          95L, 
          149L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          71L, 
          102L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          90L, 
          139L
      )))
  
  }
  
  main()
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;
  }