title: Remainder 7 Large Numbers
signature: function remainder_7_large_numbers(num)
source_py: def remainder_7_large_numbers(num):
      series = [1, 3, 2, (- 1), (- 3), (- 2)]
      series_index = 0
      result = 0
      for i in range((len(num) - 1), (- 1), (- 1)):
          digit = (ord(num[i]) - 48)
          result += (digit * series[series_index])
          series_index = ((series_index + 1) % 6)
          result %= 7
      if (result < 0):
          result = ((result + 7) % 7)
      return result
source_cpp: int remainder_7_large_numbers(string num) {
    int series [ ] = {
      1, 3, 2, - 1, - 3, - 2 };
      int series_index = 0;
      int result = 0;
      for ( int i = num . size ( ) - 1;
      i >= 0;
      i -- ) {
        int digit = num [ i ] - '0';
        result += digit * series [ series_index ];
        series_index = ( series_index + 1 ) % 6;
        result %= 7;
      }
      if ( result < 0 ) result = ( result + 7 ) % 7;
      return result;
    }
question_info.entry_fn_name: remainder_7_large_numbers
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(num, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(num) 
      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("K", 6)
      print(string.format("TEST-0...%s",result))
  
      result = driver("850076", 3)
      print(string.format("TEST-1...%s",result))
  
      result = driver("00111", 6)
      print(string.format("TEST-2...%s",result))
  
      result = driver("X", 5)
      print(string.format("TEST-3...%s",result))
  
      result = driver("1", 1)
      print(string.format("TEST-4...%s",result))
  
      result = driver("10010001100", 1)
      print(string.format("TEST-5...%s",result))
  
      result = driver(" pgPeLz", 0)
      print(string.format("TEST-6...%s",result))
  
      result = driver("53212456821275", 3)
      print(string.format("TEST-7...%s",result))
  
      result = driver("101", 3)
      print(string.format("TEST-8...%s",result))
  
      result = driver("V", 3)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 6, "inputs": {"num": "K"}}, {"idx": 1, "outputs": 3, "inputs": {"num": "850076"}}, {"idx": 2, "outputs": 6, "inputs": {"num": "00111"}}, {"idx": 3, "outputs": 5, "inputs": {"num": "X"}}, {"idx": 4, "outputs": 1, "inputs": {"num": "1"}}, {"idx": 5, "outputs": 1, "inputs": {"num": "10010001100"}}, {"idx": 6, "outputs": 0, "inputs": {"num": " pgPeLz"}}, {"idx": 7, "outputs": 3, "inputs": {"num": "53212456821275"}}, {"idx": 8, "outputs": 3, "inputs": {"num": "101"}}, {"idx": 9, "outputs": 3, "inputs": {"num": "V"}}]