# qiskit.aqua.algorithms.Grover.optimal_num_iterations¶

static Grover.optimal_num_iterations(num_solutions, num_qubits)[source]

Return the optimal number of iterations, if the number of solutions is known.

Parameters
• num_solutions (int) – The number of solutions.

• num_qubits (int) – The number of qubits used to encode the states.

Return type

int

Returns

The optimal number of iterations for Grover’s algorithm to succeed.