Question

3. (10 pts.) You are in charge of the United States Mint. The money-printing machine has developed a strange bug: it will only print a bill if you give it

one first. If you give it a d-dollar bill, it is only willing to print bills of value d² mod 400 and d² + 1 mod 400. For example, if you give it a $6 bill, it is willing to print $36 and $37 bills, and if you then give it a $36-dollar bill, it is willing to print $96 and $97. You start out with only a $1 bill to give the machine. Every time the machine prints a bill, you are allowed togive that bill back to the machine, and it will print new bills according to the rule described above. You want to know if there is a sequence of actions that will allow you to print a $20 bill, starting from your $1 bill.Model this task as a graph problem: give a precise definition of the graph (what are the vertices and edges)involved and state the specific question about this graph that needs to be answered. Give an algorithm to solve the stated problem and give the running time of your algorithm.

Fig: 1

Fig: 2