Dim x As Integer
Dim t As String = ""
For i = 1 To 1000
For j = 1 To i - 1
If i Mod j = 0 Then
x = x + j
t = t & j & "+"
End If
Next
If i = x Then
Debug.Print(i & "=" & t)
End If
x = 0
t = ""
Next
印出來會變成
6=1+2+3+
28=1+2+4+7+14+
496=1+2+4+8+16+31+62+124+248+
要怎麼把後面的+弄掉