VB6/VBA - 147 chars
I'm not allowed to leave comments , but it is possible to shorten the previous answer somewhat by not having Option Explicit
. Taking advantage of some of the more dangerous features of VB6/VBA you can use the one below. No need to declare what the variable is and also the function doesn't need to be declared public either if going for ultimate shortness! Also the End If is not needed if it is on the same line.
Function P(N As Long)
Dim I, O
Do While N > 1: For I = 2 To N
If N Mod I = 0 Then O = O & " " & I: N = N / I: Exit For:
Next: Loop: P = O
End Function
This can be tested by :
Public Sub TestP()
Dim s: s = P(1806046)
Debug.Print s
End Sub