The Solution of the Puzzle of the Month

Author(s): Cedric R. Bastiaans
Pub Details: Time Designs Magazine v4 n5 (Volume 4, Issue 5)
Date: July/August 1988
Pages: 27, 29

Puzzle of the Month

The GIVENS of this puzzle are:

A. There are 5 children, all more than 1 year old and younger than 25.

B. Their combined ages total 40.

C. The product of the boys’ ages is 39 times the product of the girls’ ages.

D. Next year, the product of the boys’ ages is an even number of times the product of the girls’ ages.

CAN YOU COME UP WITH A PROGRAM FOR OUR COMPUTERS TO FIGURE OUT THE AGES OF THE FIVE CHILDREN???

The Solution of the Puzzle of the Month

First, we’ll give the children some simple names, very simple like a, b, c, d and e.

Then, we will assume that there are 3 girls and 2 boys. Maybe it’s the other way around, but we’ll see.

Furthermore, the number 39 can only be composed of 1×39 or 3×13. What this means is that one of the boys simply HAS to be 13 years old, while another boy’s age HAS to be divisible by 3. We may thus write:

a=13 and
b=3t, where t=1,2,3....8 (maximum 8, because no one can be older than 24).

The girls being called c,d and e, we may write (algebraically):

     39cde = 13(3t)    or    cde = t ........................(1)
Also:
     c+d+e+13+(3t) = 40    or    c+d+e = 27-3t ..............(2)

Since c,d and e are older than or as old as 2 years, we can write:

     cde >= 8 ...............................................(3)
and  c+d+e >= 6 .............................................(4)

From equations (1) and (3) follows that:

     t >= 8 .................................................(5)

On the other hand, from (2) and (4) we find:

     t <= 7 .................................................(6)

Equations (5) and (6) contradict and the truth is therefore that we have THREE boys and only TWO girls!

The situation for the 3 boys a, b and c and the 2 girls d and e is therefore a trifle different:

     39de = 13(3t)c    or    de = tc    or    c = de/t .........(7)

while, however, equation (2) still holds true!

Substituting for c in (2) yields:

     3t+de/t+d+e = 27
or   3t²+de+dt+et = 27t
or   t²+de+dt+et = 27t-2t²
or   (d+t)(e+t) = t(27-2t) ..................................(8)

We may thusly write the following program:

  10 LET A=13
20 FOR T=2 TO 7
30 LET B=3*T
40 REM EQUATION (8): LET SUM=T*(27-2*T)
50 FOR D=2 TO 24
60 FOR E=D TO 24
70 REM EQUATION (7): LET C=D*E/T
80 IF C=INT(C) AND (D+T)*(E+T)=SUM THEN
GOSUB 1000
90 NEXT E
100 NEXT D
110 NEXT T
120 STOP

1000 REM NEXT YEAR AND SOLUTION
1010 LET X=(A+1)*(B+1)*(C+1)
1020 LET Y=(D+1)*(E+1)
1030 IF X/Y=INT(X/Y) THEN PRINT
"THE BOYS ARE ";A;", ";B;
" AND";C;" YEARS, THE GIRLS
ARE ";D;" AND ";E;"."
1040 RETURN

With this program keyed into my TS2068, it displayed the solution in 11 seconds BOYS 13, 9 and 8; GIRLS 4 and 6.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.