In class I was given this problem with solution. I was hoping someone could shed some light on them.
$\underline{Question}$
Is the set K RE (recursively enumerable)?
K = { $i$ | $P_{i}$ halts on input $i$ }
$\underline{Solution}$
For j = 1 to infinity:
For i = 1 to j:
Run program i on input i for j steps; if it halts, print i
(end for)
(end for)
The solution does not seem to make sense to me since the set K is undecidable and if you can list all the elements in K then you can list all the elements in $\bar{K}$, therefore the sets K and $\bar{K}$ should be decidable by their solution.
Also, the program should not halt (or move on to the next program) if it reaches a program $i$ that does not halt. Correct?