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

Home > Just Math
Linear and Quadratic Square (Posted on 2015-03-15) Difficulty: 3 of 5
Each of A and B is a positive integer with gcd(A,B) =1 such that each of
A2 + 2*B2 and A + 2*B is a perfect square.

What is the smallest value of A + 2*B for which this is possible? Determine the next two smallest values of A+2*B that satisfy the given conditions.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 4
DefDbl A-Z
Dim  crlf$

Function mform$(x, t$)
  a$ = Format$(x, t$)
  If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
  mform$ = a$
End Function


Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 
 ChDir "\VB5 projects\flooble"

  For goal = 3 To 50000
    For b2 = 2 To goal - 1 Step 2
      b = b2 / 2: a = goal - b2
      sr1 = Int(Sqr(goal) + 0.5)
      If sr1 * sr1 = goal Then
        If gcd(a, b) = 1 Then
          f2 = a * a + b2 * b
          sr = Int(Sqr(f2) + 0.5)
          If sr * sr = f2 Then
            Text1.Text = Text1.Text & mform(a, "######0") & mform(b, "#####0") & "    " & mform(f2, "###########0") & mform(goal, "#######0")
            Text1.Text = Text1.Text & "   " & mform(sr, "######0") & mform(sr1, "#####0") & crlf
            DoEvents
          End If
        End If
      End If
    Next
  Next

  Text1.Text = Text1.Text & "done"
  DoEvents

End Sub

Function gcd(a, b)
  x = a: y = b
  Do
   q = Int(x / y)
   z = x - q * y
   x = y: y = z
  Loop Until z = 0
  gcd = x
End Function

finds the 21 smallest such values with 24 cases of A and B, as 3 values of A + 2*B can result from two different pairs (A,B) each:

                                           respective
     A     B      A^2 + 2*B^2  A + 2*B    square roots
      1    12             289      25        17     5
    257   136          103041     529       321    23
    217   204          130321     625       361    25
    233   304          239121     841       489    29
    337   756         1256641    1849      1121    43
    889   660         1661521    2209      1289    47
   1777   516         3690241    2809      1921    53
   1049  1720         7017201    4489      2649    67
   3049  1140        11895601    5329      3449    73
   6433  1296        44742721    9025      6689    95
   4937  2044        32729841    9025      5721    95
   5921  3652        61732449   13225      7857   115
   9289  3168       106357969   15625     10313   125
   8233  5544       129254161   19321     11369   139
  14249  3388       225991089   21025     15033   145
   2513  9256       177662241   21025     13329   145
  16961  2620       301404321   22201     17361   149
  13777  6396       271623361   26569     16481   163
   4249 12840       347785201   29929     18649   173
   7441 14520       477029281   36481     21841   191
  25769  6520       749062161   38809     27369   197
   6793 18864       757845841   44521     27529   211
  36961  4632      1409026369   46225     37537   215
  10057 18084       755205361   46225     27481   215
  
Only values of A + 2*B up to 50,000 were computed.  

  Posted by Charlie on 2015-03-15 12:52: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 (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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