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