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

Home > Numbers
Quite a pair! (Posted on 2018-01-26) Difficulty: 3 of 5
The numbers A & B:
1. Comprise 5 distinct digits each.
2. Jointly use all 10 digits.
3. None has a leading zero.
4. Both A^2 and B^2 are 10-pandigital numbers.

Find the values of A and B.

No Solution Yet Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2
  A    B           A^2        B^2
35172 60984     1237069584 3719048256
57321 60984     3285697041 3719048256
58413 96702     3412078569 9351276804
59403 76182     3528716409 5803697124

A and B can of course be switched.

DefDbl A-Z
Dim crlf$, validnum(1000) As String, validnums


Private Sub Form_Load()
 Form1.Visible = True
 
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 For a = 1 To 9
 For b = 0 To 9
   If b <> a Then
     For c = 0 To 9
       If c <> a And c <> b Then
         For d = 0 To 9
           If d <> a And d <> b And d <> c Then
             For e = 0 To 9
               If e <> a And e <> b And e <> c And e <> d Then
                 n = 10000 * a + 1000 * b + 100 * c + 10 * d + e
                 nsq = n * n
                 s$ = LTrim(Str(nsq))
                 If Len(s) = 10 Then
                  good = 1
                  For i = 2 To 10
                    If InStr(s, Mid(s, i, 1)) < i Then good = 0: Exit For
                  Next
                  If good Then
                    validnums = validnums + 1
                    validnum(validnums) = n
                  End If
                  DoEvents
                 End If
               End If
             Next e
           End If
         Next d
       End If
     Next c
   End If
 Next b
 Next a
 
 For i = 1 To validnums - 1
  For j = i + 1 To validnums
    concat$ = validnum(i) + validnum(j)
    good = 1
    For k = 2 To 10
      If InStr(concat, Mid(concat, k, 1)) < k Then good = 0: Exit For
    Next
    If good Then
       Text1.Text = Text1.Text & validnum(i) & " " & validnum(j) & "     "
       Text1.Text = Text1.Text & validnum(i) ^ 2 & " " & validnum(j) ^ 2 & crlf
    End If
  Next
 Next
  
 Text1.Text = Text1.Text & crlf & validnums & " done"
  
End Sub


  Posted by Charlie on 2018-01-26 14:13:29
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