local n = io.read("*n") local max = math.ceil(math.sqrt(n)) local found = false for i = 3, max do if(n % i == 0) then print(i) found = true break end end if(not found) then if(n % 2 == 0) then print(n / 2) else print(n) end end