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

Home > Just Math
Triangular and Square Settlement (Posted on 2015-10-13) Difficulty: 3 of 5
A is a triangular number and B is a perfect square such that:
A – B = 2015

Find the four smallest values of A+B

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 7 |
The four smallest values of A + B are 2017, 2407, 2815 and 4465, from:

                             ordinal 
     A      B        A+B    tri   sq
   2016      1      2017     63    1
   2211    196      2407     66   14
   2415    400      2815     69   20
   3240   1225      4465     80   35
   5151   3136      8287    101   56
   8256   6241     14497    128   79
  10296   8281     18577    143   91
  17391  15376     32767    186  124
  18915  16900     35815    194  130
  32640  30625     63265    255  175
  41616  39601     81217    288  199
  72771  70756    143527    381  266
 139656 137641    277297    528  371
 246051 244036    490087    701  494
 315615 313600    629215    794  560

DefDbl A-Z
Dim crlf$

Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 For addend = 1 To 1000
   DoEvents
   tri = tri + addend
   If tri >= 2015 Then
     sq = tri - 2015
     sr = Int(Sqr(sq) + 0.5)
     If sr * sr = sq Then
       Text1.Text = Text1.Text & mform(tri, "######0") & mform(sq, "######0") & "   " & mform(tri + sq, "######0") & mform(addend, "######0") & mform(sr, "####0") & crlf
     End If
   End If
 Next

 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

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


  Posted by Charlie on 2015-10-13 15:34:15
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 (15)
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