Assignments: These assignments are optional, but highly encouraged. They will not be checked.

- Install Dwave's qOp on your computer, see instructions here.
- (30 points)
Try out the factoring-42 example:
cd qOp cd examples cd toq toqSim factor42.toq

As you can see, only 3-bit answers are given.

Extend the program to return all pairs of factors.

Hint: How many bits would you need? Run your program and check if the result is correct.

There are 6 solutions, 3 unique ones, the rest are permutations.A note on the side, see the comment in the factor42.toq file: "the FrontEnd solves this case alone". This means that toq uses a constrained solver for single-line asserts. If you specify multiple asserts, the D-Wave system will be used, "which finds the optimal solution to the input problem, and the results (values of the booleans) are passed back to the caller." (see TOQ.pdf documentation)

Turn in file factor42a.toq

- (30 points)
Revisit the embedding
example that takes the 3-Qbit solution (slide 5) to a 4-Qbit
solution (slide 10). Fill in the
spreadsheet with the correct
weights and strengths, first in the 3-Qbit tab, then in the 4-Qbit
tab.

Hints:- For 4-Qbits, which strengths remain zero (because the bipartite graph has no connections on Dwave's machine)?
- How do you replicate a Qbit in terms of weight and strengths?
- How do you connect the replicated Qbits using the "equal" circuit?

Turn in a screen shot of the spreadsheet as file embed4.pdf

- (40 points)
Following up on the last exercise, let's try to embed the "imply"
circuit from of slide 8 in
a 4-Qbit subset in the spreadsheet.

Hints:- Set the a-weights for q1 and q2 and the strength for b12. Notice that you already have a solution, but that's not the point. We want to learn how to embed multiple Qbits at once.
- Split both q1 and q2 into q1+q4 and q2+q3, adjust the a-weights.
- Connect your split Qbits with the "equal" circuit (using -2 strengths) and adjust the a-weights accordingly.

Turn in a screen shot of the spreadsheet as file imply4.pdf