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

Home > Numbers
Pandigital and divisible (Posted on 2017-12-29) Difficulty: 3 of 5
List all the numbers like 2,438,195,760
i.e.
- being pandigital (10 distinct digits)
and
- divisible by each of the integers below 23,
19
excluded.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution (spoiler) | Comment 1 of 3
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
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information