The multiplication of a 3-digit and a 2-digit number is represented below. Each * represents a prime digit. Determine the two numbers.
***
**
------
****
****
------
*****
775
33
----------
2325
2325
----------
25575
For a = 222 To 777
For b = 22 To 77
prod = a * b
If prod >= 2222 And prod <= 77777 Then
sp1 = a * (b Mod 10)
If sp1 >= 2222 And sp1 <= 7777 Then
sp2 = a * (b \ 10)
If sp2 >= 2222 And sp2 <= 7777 Then
tst$ = Str(a) + Str(b) + Str(sp1) + Str(sp2) + Str(prod)
good = 1
For i = 1 To Len(tst)
If InStr("2357 ", Mid(tst, i, 1)) = 0 Then good = 0: Exit For
Next
If good Then
Text1.Text = Text1.Text & " " & a & crlf & " " & b & crlf
Text1.Text = Text1.Text & "----------" & crlf
Text1.Text = Text1.Text & " " & sp1 & crlf & sp2 & crlf
Text1.Text = Text1.Text & "----------" & crlf
Text1.Text = Text1.Text & prod & crlf & crlf
End If
End If
End If
End If
Next
Next
|
Posted by Charlie
on 2019-08-07 09:43:28 |