The multiplier for 99 must end ...03 in order that the product end in ...97. The multiplier must begin 979... or 98... in order for the product to begin 97....
The multiple must have at least 13 digits, and so be 99 times a number between 9888888888 and
pt1 = 98000000003# * 99
midpart1 = 9900
endpt = 9900# * 10101011#
For n = pt1 To endpt + pt1 Step midpart1
DoEvents
If sod(n) = 99 Then
Text1.Text = Text1.Text & n & crlf
End If
Next
gives
9731999999997
while
pt1 = 97900000003# * 99
midpart1 = 9900
endpt = 9900# * 10101011#
For n = pt1 To endpt + pt1 Step midpart1
DoEvents
If n > 9699999999999# Then
If sod(n) = 99 Then
Text1.Text = Text1.Text & n & crlf
Exit Sub
End If
End If
Next
increments up to that same answer.
BTW the sod function is
Function sod(n)
s$ = LTrim(Str(n))
tot = 0
For i = 1 To Len(s$)
tot = tot + Val(Mid(s$, i, 1))
Next
sod = tot
End Function
|
Posted by Charlie
on 2016-07-19 14:51:57 |