This code was tested on IBM's 5-Qubit processor as an implementation of Grover's search algorithm, but for an unknown number of solutions. This code is based on Arthur Pittenger's book, "An Introduction to Quantum Computing Algorithms" and the mathematical structure was posted as a proof-verification question here.
h q; h q; x q; s q; cx q, q; t q; cx q, q; s q; x q; z q; s q; tdg q; cx q, q; id q; cx q, q; h q; h q; h q; x q; x q; x q; cx q, q; h q; cx q, q; s q; h q; tdg q; h q; measure q; measure q; measure q; measure q; measure q;
For successful implementations of Grover's algorithm, there has to be a bias towards $$\vert 0 \rangle$$ while $$\vert 1 \rangle$$ only occurs upon a successful query of the qubit oracle.
In line with this, the output produces a probabilistic distribution across all possible output permutations of the 5-qubit system, with a |0> bias. Since I am using the "amplitude amplification" method, or "reflection about the mean" the output value will generate a fluctuation in probabilities based on the solution to the problem presented. The fifth qubit Q4 is unused, and is reserved for problem encoding.
While IBM allows anyone to publicly access their 5 qubit processor, you will need to be upgraded to Expert User status to copy/paste the QASM code provided. Otherwise, as a Standard User you can build this same algorithm by following the drag and drop operations provided. I've already run this experiment on their live system using 4096 shots, as I do with all tests I run live.
I'd like feedback on suggestions of whether I need to keep the Q4 qubit reserved strictly for problem encoding, or if a problem would be more optimally encoded distributed across all qubits.