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

Home > Just Math
Find From First and Last (Posted on 2016-02-02) Difficulty: 3 of 5
N is a perfect square whose first four digits are 2016 and the last four digits are also 2016.

Determine the four smallest values of N.

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 1 of 1

        N                   sqrt(N)
   201604592016              449004
 20169045072016             4490996
201611714592016            14199004
201668287392016            14200996
201682715862016            14201504

In fact by stretching VB's precision to its limits we get:

2.01609944179202E+15            44900996
2.01614506146202E+15            44901504
2.01632395302202E+15            44903496
2.01636957523202E+15            44904004
2.01654847675202E+15            44905996
2.01659410150202E+15            44906504
2.01677301298202E+15            44908496
2.01681864027202E+15            44909004
2.01699756171202E+15            44910996

Though the output has switched to a rounded scientific form, the last digits of the square roots verify the exactness of the results.


DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 pwr10 = 100000
 Do
  low = -Int(-Sqr(2016 * pwr10))  ' ceiling
  high = Int(Sqr(2017 * pwr10))   ' floor
  For sr = low To high
   DoEvents
    sq = sr * sr
    sqred = Int(sq / 10000)
    sqmod = sq - 10000 * sqred  ' workaround for type limitation on mod function
    If sqmod = 2016 Then
      Text1.Text = Text1.Text & sq & "            " & sr & crlf
    End If
  Next
  pwr10 = pwr10 * 10
 Loop Until pwr10 > 100000000000#

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


  Posted by Charlie on 2016-02-02 11:27:00
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 (16)
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