How many 3 digit numbers N are there such that the digits of N and 3N are all even? (There is no restriction on the number of digits of 3N)
There are
24:
N 3N
200 600
202 606
208 624
220 660
222 666
228 684
268 804
280 840
282 846
288 864
668 2004
680 2040
682 2046
688 2064
800 2400
802 2406
808 2424
820 2460
822 2466
828 2484
868 2604
880 2640
882 2646
888 2664
For n = 200 To 888 Step 2
n3 = n * 3
tst$ = LTrim(Str(n)) + LTrim(Str(n3))
good = 1
For i = 1 To Len(tst)
If InStr("02468", Mid(tst, i, 1)) = 0 Then good = 0: Exit For
Next
If good Then ct = ct + 1: Text1.Text = Text1.Text & n & " " & n3 & crlf
Next
|
Posted by Charlie
on 2019-05-18 14:07:48 |