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

 Make it solvable (Posted on 2005-05-05)
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.)
 Rounding error | Comment 13 of 16 |
(In reply to The correct(?) solution by John Reid)

The error in my program is the line

IF b < a THEN EXIT DO

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:
 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 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information