title: Count Digits Factorial Set 1
signature: function count_digits_factorial_set_1(n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(n, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(n), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(66, 93);
      @printf("TEST-0...%s\n",result);
      
      result = driver(7, 4);
      @printf("TEST-1...%s\n",result);
      
      result = driver(55, 74);
      @printf("TEST-2...%s\n",result);
      
      result = driver(37, 44);
      @printf("TEST-3...%s\n",result);
      
      result = driver(76, 112);
      @printf("TEST-4...%s\n",result);
      
      result = driver(16, 14);
      @printf("TEST-5...%s\n",result);
      
      result = driver(17, 15);
      @printf("TEST-6...%s\n",result);
      
      result = driver(95, 149);
      @printf("TEST-7...%s\n",result);
      
      result = driver(71, 102);
      @printf("TEST-8...%s\n",result);
      
      result = driver(90, 139);
      @printf("TEST-9...%s\n",result);
      
  end
  
  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;
  }