title: Find Minimum Number Divided Make Number Perfect Square
signature: function find_minimum_number_divided_make_number_perfect_square(n)
source_py: def find_minimum_number_divided_make_number_perfect_square(n):
      count = 0
      ans = 1
      while ((n % 2) == 0):
          count += 1
          n //= 2
      if ((count % 2) is not 0):
          ans *= 2
      for i in range(3, (int(math.sqrt(n)) + 1), 2):
          count = 0
          while ((n % i) == 0):
              count += 1
              n //= i
          if ((count % 2) is not 0):
              ans *= i
      if (n > 2):
          ans *= n
      return ans
source_cpp: int find_minimum_number_divided_make_number_perfect_square(int n) {
    int count = 0, ans = 1;
    while ( n % 2 == 0 ) {
      count ++;
      n /= 2;
    }
    if ( count % 2 ) ans *= 2;
    for ( int i = 3;
    i <= sqrt ( n );
    i += 2 ) {
      count = 0;
      while ( n % i == 0 ) {
        count ++;
        n /= i;
      }
      if ( count % 2 ) ans *= i;
    }
    if ( n > 2 ) ans *= n;
    return ans;
  }
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(95, 95)
      print(string.format("TEST-0...%s",result))
  
      result = driver(48, 3)
      print(string.format("TEST-1...%s",result))
  
      result = driver(3, 3)
      print(string.format("TEST-2...%s",result))
  
      result = driver(10, 10)
      print(string.format("TEST-3...%s",result))
  
      result = driver(82, 82)
      print(string.format("TEST-4...%s",result))
  
      result = driver(1, 1)
      print(string.format("TEST-5...%s",result))
  
      result = driver(77, 77)
      print(string.format("TEST-6...%s",result))
  
      result = driver(99, 11)
      print(string.format("TEST-7...%s",result))
  
      result = driver(23, 23)
      print(string.format("TEST-8...%s",result))
  
      result = driver(61, 61)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 95, "inputs": {"n": 95}}, {"idx": 1, "outputs": 3, "inputs": {"n": 48}}, {"idx": 2, "outputs": 3, "inputs": {"n": 3}}, {"idx": 3, "outputs": 10, "inputs": {"n": 10}}, {"idx": 4, "outputs": 82, "inputs": {"n": 82}}, {"idx": 5, "outputs": 1, "inputs": {"n": 1}}, {"idx": 6, "outputs": 77, "inputs": {"n": 77}}, {"idx": 7, "outputs": 11, "inputs": {"n": 99}}, {"idx": 8, "outputs": 23, "inputs": {"n": 23}}, {"idx": 9, "outputs": 61, "inputs": {"n": 61}}]
question_info.extension: lua
question_info.entry_fn_name: find_minimum_number_divided_make_number_perfect_square
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__