Function D(N As Double) As String 'décompose N en nombres premiers
Dim maxi As Long, liste As New Collection, i As Long, j As Long
maxi = 10000 'modifiable
If N = 0 Or Int(N) <> N Or N > maxi Then Exit Function
'---Liste des nombres premiers---
liste.Add 2
For i = 3 To N Step 2
For j = 2 To liste.Count
If liste(j) > Evaluate("SQRT(" & i & ")") Then Exit For
If i Mod liste(j) = 0 Then GoTo 1
Next
liste.Add i
1 Next
'---Calcul de D---
For i = 1 To liste.Count
If N Mod liste(i) = 0 Then
j = 1
2 j = j + 1
If N Mod liste(i) ^ j = 0 Then GoTo 2
D = D & IIf(D = "", "", "*") & liste(i) & IIf(j = 2, "", "^" & j - 1)
If Evaluate(D) = N Then Exit For
End If
Next
If D = "" Then D = N
End Function