All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Smallest Multiple of 99 (Posted on 2016-07-19)
Determine the minimum positive integer multiple of 99, such that
The sum of the digits is 99, and
The multiple begins and ends with 97.

 No Solution Yet Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 Seems to be | Comment 2 of 3 |
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

 Search: Search body:
Forums (0)