A chunk of pages is missing from a book. The sum of the missing page numbers is 9808. What are those page numbers?
If a is the last missing page and b is the first, then the sum of the missing page numbers will be
(a+b)(ab+1)/2
Multiplied out:
(a^2  b^2 + a + b) / 2 = 9808
a^2 + a + b(1b)  19616 = 0
Using the quadratic formula to solve for a, when b is given, and assuming that a should be positive:
a = (1 + sqrt(1  4b(1b)) / 2
Then trying all the odd b values between 1 and 999, seeking a positive integer for a, hopefully even:
DEFDBL AZ
FOR b = 1 TO 999 STEP 2
c = b * (1  b)  19616
disc = 1  4 * c
IF disc >= 0 THEN
sr = INT(SQR(disc) + .5)
IF sr * sr = disc THEN
a1 = (1 + sr) / 2
IF a1 = INT(a1) THEN
PRINT b, a1
END IF
END IF
END IF
NEXT b
we find b = 291 and a = 322, as the first and last of the missing pages.

Posted by Charlie
on 20091113 16:48:23 