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

Home > Numbers
Make it solvable (Posted on 2005-05-05) Difficulty: 4 of 5
a, b, and x are positive integers such that

sqrt(a) + sqrt(b) = sqrt(x)

How many possible values of x less than or equal to 1000 are there?

See The Solution Submitted by Jer    
Rating: 3.6667 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Rounding error | Comment 13 of 16 |
(In reply to The correct(?) solution by John Reid)

The error in my program is the line


The first value of x missed was 24, for which, when this line was encountered, b was 5.9999999999999 and a was 6.  If precision were perfect, both would have been 6 and b would not have been considered less than a.  The corrected program has

IF b - a < -.0000001# THEN EXIT DO

and produces statistics:

392           961           30            240

showing 392 values of x from 961 possible sums.

  Posted by Charlie on 2005-05-06 13:47:18
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (5)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information