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

Home > Just Math
Prime stars (Posted on 2018-04-13) Difficulty: 4 of 5
   ***
X  ***
  **** 
 ****   
****  
******

Each of the asterisks represents a prime digit.

Restore the original multiplication.

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 Comment 2 of 2 |
DefDbl A-Z
Dim crlf$

Private Sub Form_Load()
 Form1.Visible = True
 Text1.Text = ""
 crlf = Chr(13) + Chr(10)
 
 For ord1 = 1 To 4
   d1 = Val(Mid("2357", ord1, 1))
 For ord2 = 1 To 4
   d2 = Val(Mid("2357", ord2, 1))
 For ord3 = 1 To 4
   d3 = Val(Mid("2357", ord3, 1))
 For ord4 = 1 To 4
   d4 = Val(Mid("2357", ord4, 1))
 For ord5 = 1 To 4
   d5 = Val(Mid("2357", ord5, 1))
 For ord6 = 1 To 4
   d6 = Val(Mid("2357", ord6, 1))
   m1 = 100 * d1 + 10 * d2 + d3
   m2 = 100 * d4 + 10 * d5 + d6
   prod = m1 * m2
   If prod > 99999 And prod < 1000000 Then
     p1 = m1 * d6: p2 = m1 * d5: p3 = m1 * d4
     If p1 > 999 And p1 < 10000 Then
     If p2 > 999 And p2 < 10000 Then
     If p3 > 999 And p3 < 10000 Then
       digused$ = LTrim(Str(prod)) + LTrim(Str(p1)) + LTrim(Str(p2)) + LTrim(Str(p3))
       good = 1
       For i = 1 To Len(digused)
          If InStr("2357", Mid(digused, i, 1)) = 0 Then good = 0: Exit For
       Next
       If good Then
         Text1.Text = Text1.Text & "   " & m1 & crlf & "   " & m2 & crlf
         Text1.Text = Text1.Text & "------" & crlf
         Text1.Text = Text1.Text & "  " & p1 & crlf
         Text1.Text = Text1.Text & " " & p2 & crlf
         Text1.Text = Text1.Text & p3 & crlf
         Text1.Text = Text1.Text & "------" & crlf
         Text1.Text = Text1.Text & prod & crlf
       End If
     End If
     End If
     End If
   End If
   DoEvents
 Next
 Next
 Next
 Next
 Next
 Next
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

finds

   325
   777
------
  2275
 2275
2275
------
252525

  Posted by Charlie on 2018-04-13 12:05:10
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 (8)
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