Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
For n = 1 To 100000
If n / ssd(n) = 9 Then
Text1.Text = Text1.Text & n & Str(ssd(n)) & crlf
DoEvents
End If
Next n
Text1.Text = Text1.Text & "done" & crlf
End Sub
Function ssd(x)
tot = 0
s$ = LTrim(Str(x))
For i = 1 To Len(s)
d = Val(Mid(s, i, 1))
tot = tot + d * d
Next
ssd = tot
End Function
finds only
315 35
where N=315 and SSD(N) = 35.
All numbers through 5-digit length were checked. Beyond that, such an equality would be impossible as 9*(9^2)*6 is only a 4-digit number (4374).
|
Posted by Charlie
on 2015-03-30 22:04:20 |