title: Count Digits Factorial Set 1
signature: function count_digits_factorial_set_1(n)
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;
  }
question_info.entry_fn_name: count_digits_factorial_set_1
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(66, 93)
      print(string.format("TEST-0...%s",result))
  
      result = driver(7, 4)
      print(string.format("TEST-1...%s",result))
  
      result = driver(55, 74)
      print(string.format("TEST-2...%s",result))
  
      result = driver(37, 44)
      print(string.format("TEST-3...%s",result))
  
      result = driver(76, 112)
      print(string.format("TEST-4...%s",result))
  
      result = driver(16, 14)
      print(string.format("TEST-5...%s",result))
  
      result = driver(17, 15)
      print(string.format("TEST-6...%s",result))
  
      result = driver(95, 149)
      print(string.format("TEST-7...%s",result))
  
      result = driver(71, 102)
      print(string.format("TEST-8...%s",result))
  
      result = driver(90, 139)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 93, "inputs": {"n": 66}}, {"idx": 1, "outputs": 4, "inputs": {"n": 7}}, {"idx": 2, "outputs": 74, "inputs": {"n": 55}}, {"idx": 3, "outputs": 44, "inputs": {"n": 37}}, {"idx": 4, "outputs": 112, "inputs": {"n": 76}}, {"idx": 5, "outputs": 14, "inputs": {"n": 16}}, {"idx": 6, "outputs": 15, "inputs": {"n": 17}}, {"idx": 7, "outputs": 149, "inputs": {"n": 95}}, {"idx": 8, "outputs": 102, "inputs": {"n": 71}}, {"idx": 9, "outputs": 139, "inputs": {"n": 90}}]