title: Check If A Number Is Power Of Another Number 1
signature: function check_if_a_number_is_power_of_another_number_1(x, y)
source_py: def check_if_a_number_is_power_of_another_number_1(x, y):
      res1 = (math.log(y) / math.log(x))
      res2 = (math.log(y) / math.log(x))
      return (1 if (res1 == res2) else 0)
source_cpp: bool check_if_a_number_is_power_of_another_number_1(int x, int y) {
    int res1 = log ( y ) / log ( x );
    double res2 = log ( y ) / log ( x );
    return ( res1 == res2 );
  }
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(x, y, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(x, y) 
      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(57, 1, 1)
      print(string.format("TEST-0...%s",result))
  
      result = driver(3, 9, 1)
      print(string.format("TEST-1...%s",result))
  
      result = driver(10, 101, 1)
      print(string.format("TEST-2...%s",result))
  
      result = driver(10, 10000, 1)
      print(string.format("TEST-3...%s",result))
  
      result = driver(6, 46656, 1)
      print(string.format("TEST-4...%s",result))
  
      result = driver(2, 2048, 1)
      print(string.format("TEST-5...%s",result))
  
      result = driver(2, 40, 1)
      print(string.format("TEST-6...%s",result))
  
      result = driver(20, 79, 1)
      print(string.format("TEST-7...%s",result))
  
      result = driver(96, 98, 1)
      print(string.format("TEST-8...%s",result))
  
      result = driver(25, 5, 1)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 1, "inputs": {"x": 57, "y": 1}}, {"idx": 1, "outputs": 1, "inputs": {"x": 3, "y": 9}}, {"idx": 2, "outputs": 1, "inputs": {"x": 10, "y": 101}}, {"idx": 3, "outputs": 1, "inputs": {"x": 10, "y": 10000}}, {"idx": 4, "outputs": 1, "inputs": {"x": 6, "y": 46656}}, {"idx": 5, "outputs": 1, "inputs": {"x": 2, "y": 2048}}, {"idx": 6, "outputs": 1, "inputs": {"x": 2, "y": 40}}, {"idx": 7, "outputs": 1, "inputs": {"x": 20, "y": 79}}, {"idx": 8, "outputs": 1, "inputs": {"x": 96, "y": 98}}, {"idx": 9, "outputs": 1, "inputs": {"x": 25, "y": 5}}]
question_info.extension: lua
question_info.entry_fn_name: check_if_a_number_is_power_of_another_number_1
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__