title: Count Digits Factorial Set 1
signature: function countDigitsFactorialSet1($n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        66, 
        93));
      
      printf("TEST-1...%s\n",driver(
        7, 
        4));
      
      printf("TEST-2...%s\n",driver(
        55, 
        74));
      
      printf("TEST-3...%s\n",driver(
        37, 
        44));
      
      printf("TEST-4...%s\n",driver(
        76, 
        112));
      
      printf("TEST-5...%s\n",driver(
        16, 
        14));
      
      printf("TEST-6...%s\n",driver(
        17, 
        15));
      
      printf("TEST-7...%s\n",driver(
        95, 
        149));
      
      printf("TEST-8...%s\n",driver(
        71, 
        102));
      
      printf("TEST-9...%s\n",driver(
        90, 
        139));
      
  }
  
  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;
  }