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

 Some Sum Squares To Product (Posted on 2008-11-22)
The product of the ages of Timothy’s children is the square of the sum of their ages. Timothy has at least 2 children but less than 8 children. All of his children are at least 2 years old and at most 14 years old. All the ages of the children are different and the age of each child is a positive integer when expressed in years.

How many children are there and what are their ages?

 See The Solution Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution Comment 1 of 1
DECLARE SUB choose (child!)
DIM SHARED n, childage(8)
CLS

FOR n = 2 TO 7
choose 1
NEXT

SUB choose (child)
st = 2
IF child > 1 THEN
st = childage(child - 1) + 1
END IF
FOR age = st TO 14
childage(child) = age
IF child < n THEN
choose child + 1
ELSE
prod = 1: sum = 0
FOR i = 1 TO n
prod = prod * childage(i)
sum = sum + childage(i)
NEXT i
IF prod = sum * sum THEN
FOR i = 1 TO n
PRINT childage(i);
NEXT i
PRINT , prod; sum: PRINT
END IF
END IF
NEXT age
END SUB

produces

2  4  6  12   576  24

indicating four children, ages 2, 4, 6 and 12, adding to 24 and multiplying out to 576.

 Posted by Charlie on 2008-11-22 19:57:52

 Search: Search body:
Forums (0)