To be divisible by each of the integers below 23 save for 19, it is necessary and sufficient to be divisible by each integer below 19, as 20 is covered by 5 and 4, 21 is covered by 3 and 7 and 22 by 2 and 11.
The LCM of the first 18 whole numbers is 12,252,240 (2^4 * 3^2 * 5 * 7 * 11 * 13 * 17) so we need only check multiples of that number and find any that are 10-digit pandigital. There are four of them:
2438195760
3785942160
4753869120
4876391520
from the program where we check all 10-digit multiples for being pandigital, and stop the search as soon as 10 digits are exceeded.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
unit = 12252240
n = 10 * unit
Do
n = n + unit
ns$ = LTrim(Str(n))
If Len(ns) = 10 Then
good = 1
For i = 1 To 10
If InStr(ns, Mid("0123456789", i, 1)) = 0 Then good = 0: Exit For
Next
If good Then
Text1.Text = Text1.Text & n & crlf
End If
End If
DoEvents
Loop Until Len(ns) > 10
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2017-12-29 11:15:53 |