title: Count Digits Factorial Set 1
signature: function countDigitsFactorialSet1(n: number): number {
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.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}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(66, 93);
    console.log(`TEST-0...${result}`);
  
    result = driver(7, 4);
    console.log(`TEST-1...${result}`);
  
    result = driver(55, 74);
    console.log(`TEST-2...${result}`);
  
    result = driver(37, 44);
    console.log(`TEST-3...${result}`);
  
    result = driver(76, 112);
    console.log(`TEST-4...${result}`);
  
    result = driver(16, 14);
    console.log(`TEST-5...${result}`);
  
    result = driver(17, 15);
    console.log(`TEST-6...${result}`);
  
    result = driver(95, 149);
    console.log(`TEST-7...${result}`);
  
    result = driver(71, 102);
    console.log(`TEST-8...${result}`);
  
    result = driver(90, 139);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: countDigitsFactorialSet1
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js