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

Home > Numbers
Four integers (Posted on 2016-12-04) Difficulty: 3 of 5
Find four distinct positive integers such that:
a. Each of them is below 500.
b. Multiplying any two of them and then incrementing the product by 1
produces a square number.

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 8
DefDbl A-Z
Dim crlf$, n(4)

Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 For a = 1 To 496
   n(1) = a
   addOn 2
 Next
  
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

Sub addOn(wh)
 For newNum = n(wh - 1) + 1 To 499
   n(wh) = newNum
   good = 1
   For i = 1 To wh - 1
    For j = i + 1 To wh
      DoEvents
      sq = n(i) * n(j) + 1
      sr = Int(Sqr(sq) + 0.5)
      If sr * sr <> sq Then good = 0: Exit For
    Next
    If good = 0 Then Exit For
   Next
   If good Then
     If wh = 4 Then
       For i = 1 To 4
         Text1.Text = Text1.Text & Str(n(i))
       Next
       Text1.Text = Text1.Text & crlf
     Else
       addOn wh + 1
     End If
   End If
 Next
End Sub

finds these two solutions:

 1 3 8 120
 2 4 12 420

  Posted by Charlie on 2016-12-04 11:01:08
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