I am interested in a quantum algorithm that has the following characteristics:
- output = 2n bits OR 2 sets of n bits (e.g. 2 x 3 bits)
- the number of 1-bits in the first set of n-bits must be equal to the number of 1-bits in the second set. E.g. correct output =
0,0,0, 0,0,0(both 3-bit sets have zero 1-bits);
1,0,0, 0,1,0(both 3-bit sets have one 1-bit);
1,1,0, 0,1,1(both 3-bit sets have two 1-bit)
- Each time the quantum algorithm runs it must randomly return one of the possible solutions. There are 2 good ways to interpret "randomly return one of the possible solutions": (1) each possible good solution has equal chance of being returned by the quantum algorithm. (2) every possible good solution has a chance > 0 of being returned.
Any idea how I can best implement such an algorithm on a quantum computer ?
FYI I have tried the following algorithm (where n = 2 ) but it missed the 2 answers 0110 and 1001. screenshot of the quantum circuit + simulator output