
Voici le programme complété:

\begin{python}
def decomp(n):
    D = dict() # dictionnaire vide

    k = 2

    while n > 1:
        exposant = 0
        while n%k == 0:
            exposant = exposant + 1
            n = n/k
        if exposant != 0:
            D[k] = exposant
        k = k+1
        j = 2
        while k%j == 0:
            k = k + 1

    return D
\end{python}

On a par exemple:

\begin{console}
>>> decompose(360)
{2: 3, 3: 2, 5: 1}
\end{console}

qui nous dit alors que $360=2^3 \times 3^2 \times 5^1$.
