Código
Private Function esNumeroPerfecto(ByVal numero As Double) As Boolean Dim aux(7) As Double Dim i As Integer aux(0) = 6 aux(1) = 28 aux(2) = 496 aux(3) = 8128 aux(4) = 33550336 aux(5) = 8589869056 aux(6) = 137438691328 aux(7) = 2305843008139952128 For i = 0 To 7 If numero = aux(i) Then Return True End If Next Return False End Function
Jaja fuera bromas, esto es lo que pude hacer, aunque con numeros muy grandes tarda una eternidad
Código
Este se tarda una eternidad en comprobar los ultimos 2 numeros de la lista Private Function esNumeroPerfecto(ByVal numero As Double) As Boolean Dim aux As Double = 1 Dim aux2 As Double = 0 Dim sum As Double = 0 While aux <= (numero / 2) aux2 = numero Mod aux If aux2 = 0 Then sum += aux End If aux += 1 End While Return (sum = numero) End Function
Saludos