import numpy as np

def grovers_dist(num_qubits, marked_item, n_iterations):
    dist = {}
    for i in range(2**num_qubits):
        key = bin(i)[2:].zfill(num_qubits)
        theta = np.arcsin(1/np.sqrt(2 ** num_qubits))
        if i == marked_item:
            dist[key] = np.sin((2*n_iterations+1)*theta)**2
        else:
            dist[key] = (np.cos((2*n_iterations+1)*theta)/(np.sqrt(2 ** num_qubits - 1)))**2
    return dist

num_qubits = 4
marked_item = 6
n_iterations = int(np.pi * np.sqrt(2 ** num_qubits) / 4)
grovers_dist(num_qubits, marked_item, n_iterations)

