p = 1, q = 1, n = r while n /= 0 do if n > 0 then n = n - p, p = p + 2 else n = n + q, q = q + 2 endif endwhileShow that this code must terminate, and that when it does so the values (p-q)/2 and (p+q-2)/2 are factors of r. What happens if r is (a) negative; (b) even?
[Hint: You may find it helpful to follow through the cases r = 7, 9 and 15 in detail, and to consider the sums 1+3+5+... of the values taken on by p and q.]
Possible topics include [but are not confined to]: polynomial vs. exponential operation counts, the class P of decision problems, the class NP and completeness, Cook's theorem, the hierarchy of complexity classes. Literary merit will be taken into account, and an essay which covers a few topics well will be preferred to one which consists of disconnected jottings about many.
X
's and is otherwise blank;
the read head is initially over the
rightmost-X
;
and the machine is to place on the tape the binary representation
of the number of X
's.
[Your solution need not preserve the X
's.]
Show that it is possible to construct a [single tape, single head] UTM which never changes a non-blank symbol on its tape. [You may quote general results about minimal computers, as long as they are clearly stated in your exposition.]