title: Sum Series 12 32 52 2N 12 1
signature: function sum_series_12_32_52_2n_12_1(n)
source_py: def sum_series_12_32_52_2n_12_1(n):
      return int((((n * ((2 * n) - 1)) * ((2 * n) + 1)) / 3))
source_cpp: int sum_series_12_32_52_2n_12_1(int n) {
    return ( n * ( 2 * n - 1 ) * ( 2 * n + 1 ) ) / 3;
  }
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(84, 790244)
      print(string.format("TEST-0...%s",result))
  
      result = driver(74, 540274)
      print(string.format("TEST-1...%s",result))
  
      result = driver(91, 1004731)
      print(string.format("TEST-2...%s",result))
  
      result = driver(34, 52394)
      print(string.format("TEST-3...%s",result))
  
      result = driver(36, 62196)
      print(string.format("TEST-4...%s",result))
  
      result = driver(28, 29260)
      print(string.format("TEST-5...%s",result))
  
      result = driver(70, 457310)
      print(string.format("TEST-6...%s",result))
  
      result = driver(7, 455)
      print(string.format("TEST-7...%s",result))
  
      result = driver(24, 18424)
      print(string.format("TEST-8...%s",result))
  
      result = driver(47, 138415)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 790244, "inputs": {"n": 84}}, {"idx": 1, "outputs": 540274, "inputs": {"n": 74}}, {"idx": 2, "outputs": 1004731, "inputs": {"n": 91}}, {"idx": 3, "outputs": 52394, "inputs": {"n": 34}}, {"idx": 4, "outputs": 62196, "inputs": {"n": 36}}, {"idx": 5, "outputs": 29260, "inputs": {"n": 28}}, {"idx": 6, "outputs": 457310, "inputs": {"n": 70}}, {"idx": 7, "outputs": 455, "inputs": {"n": 7}}, {"idx": 8, "outputs": 18424, "inputs": {"n": 24}}, {"idx": 9, "outputs": 138415, "inputs": {"n": 47}}]
question_info.extension: lua
question_info.entry_fn_name: sum_series_12_32_52_2n_12_1
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__