Extra Homework Problems |
Q1: Is there a URM program such that, when given input R1 = n (where n is a natural number), the program eventually stops with 0 in all registers except 1 in Rn?
Q2: Is there a URM program such that, when given input R1 = n, it eventually stops with output R1 = a random integer between 1 and n, inclusively? For example, if input is R1 = 2, then, after say 1000 runs, about 500 times the output is 1, and about 500 times the output is 2.
Q3: Suppose I'm thinking of a URM program P with L instructions. Without knowing what P is or does, can you find an N in terms of L so that you can be sure all registers after RN contain 0 when (and if) the program stops? What is the smallest such N (in terms of L)?