Grover: factorize number

from typing import Tuple
from qlasskit import qlassf, Qint
from qlasskit.algorithms import Grover


@qlassf
def factorize(a: Tuple[Qint[2], Qint[2]]) -> bool:
    return a[0] * a[1] == 9


q_algo = Grover(factorize)
from qiskit import QuantumCircuit, transpile
from qiskit.visualization import plot_histogram
from qiskit_aer import AerSimulator

qc = q_algo.export("qiskit")
qc.measure_all()
simulator = AerSimulator()
circ = transpile(qc, simulator)
result = simulator.run(circ).result()
counts = result.get_counts(circ)

counts_readable = q_algo.decode_counts(counts, discard_lower=5)
plot_histogram(counts_readable)
_images/cd532d1b2483495df851c5c47864f701f3fda1bae18be0416f1bd23e9e4dc3dd.png
qc.draw("mpl")
_images/80d77e67d7002fbb05aeb7f0366824e2628060ae4b9597b1e141d304da6ca8f8.png