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

Home > Numbers
7 hypotenuses (Posted on 2020-07-10) Difficulty: 3 of 5
What is the smallest integer that can be presented as a sum of 2 squares of distinct integers in 7 different ways?

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 1 of 4
Assuming that, for example, 400+27225 is not considered different from 27225+400, 27625 is the smallest such integer and in fact has 8 different ways:

27625   8
     400 + 27225
     729 + 26896
    2025 + 25600
    3600 + 24025
    6889 + 20736
    7744 + 19881
   10201 + 17424
   13225 + 14400
   
 For t = 2 To 1000000
   For a = 1 To t / 2
    DoEvents
     b = t - a
     n = a * a + b * b
     If n <= 1000000 Then
       numW(n) = numW(n) + 1
       how(numW(n), n) = a
       If numW(n) >= 7 Then
         Text1.Text = Text1.Text & n & "   " & numW(n) & crlf
       End If
       If numW(n) = 8 Then
         For i = 1 To 8
           Text1.Text = Text1.Text & "   "
           Text1.Text = Text1.Text & how(i, n) * how(i, n) & "   "
           r = n - how(i, n) * how(i, n)
           Text1.Text = Text1.Text & r & crlf
         Next
         GoTo finsh
       End If
       If numW(n) > maxW Then maxW = numW(n): maxN = n
     Else
       Exit For
     End If
   Next
 Next t
 
finsh:
 Text1.Text = Text1.Text & "done"

If however a+b is not considered the same as b+a, the value of a would be allowed to go all the way to t-1 in the above code:

   For a = 1 To t / 2
   
and the result would be:


1105   8
   16  +1089
   1089+  16
   81  +1024
   1024+  81
   144 + 961
   961 + 144
   529 + 576
   576 + 529

If you need exactly 7 (rather than 8):

31250   7
    625  +30625
    30625+  625
   5329  +25921
   25921 + 5329
   7225  +24025
   24025 + 7225
  15625  +15625


  Posted by Charlie on 2020-07-10 10:24:33
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