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.)
re(4): First thoughts... ...(spoiler?) | Comment 6 of 16 |
(In reply to re(3): First thoughts... ...(spoiler?) by Charlie)

The program I used to count solutions was:

DEFDBL A-Z
OPEN "makesolv.txt" FOR OUTPUT AS #2
OPEN "makesol2.txt" FOR OUTPUT AS #3
FOR x = 1 TO 1000
  sx = SQR(x)
  a = 1
  flag = 0: psqflag = 0
  DO
   sa = SQR(a)
   psq = 0
   isa = INT(sa + .5)
   IF isa * isa = a THEN psq = 1
   sb = sx - sa
   b = sb * sb
   IF b < a THEN EXIT DO
   rb = INT(b + .5)
   IF ABS(b - rb) < ABS(b) / 1E+13 THEN
     PRINT USING "#### ####.####### ####"; a; b; x;
     PRINT #2, USING "#### ####.####### ####"; a; b; x;
     ct2 = ct2 + 1
     flag = 1
     IF psq THEN
      psqflag = 1
      PRINT " *"
      PRINT #2, " *"
      psqct2 = psqct2 + 1
      IF x <> pxpsq THEN
        PRINT #3,
        pxpsq = x
      END IF
      PRINT #3, USING "#### #### ####"; a; b; x
     ELSE
      PRINT
      PRINT #2,
     END IF
   END IF
   a = a + 1
  LOOP
  IF flag THEN
   ct = ct + 1
   IF psqflag THEN ctpsq = ctpsq + 1
   PRINT
   PRINT #2,
  END IF
NEXT x
PRINT ct, ct2, ctpsq, psqct2

where the final counts came as:

355           904           30            240

indicating 355 values of x through 904 different sums, where 30 values of x were obtained through perfect squares as the integers, among 240 such sums involving perfect squares (that is sums of integers).


  Posted by Charlie on 2005-05-05 19:55:13
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 (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information