Tagged: by: Jean Harrison Toggle Comment Threads | Keyboard Shortcuts

  • Unknown's avatar

    Jim Randell 12:50 pm on 5 November 2019 Permalink | Reply
    Tags: by: Jean Harrison, ,   

    Brain-Teaser 508: [Family birthdays] 

    From The Sunday Times, 7th March 1971 [link]

    Grandma said: “Grandpa and I share between 100 and 120 years of age, being both over 50 years old. The total ages of our family (our son and his children — all of different age years, and over 12 months) exactly equal [my own age. On the same day next year they will exactly equal] Grandpa’s age.”

    “At present, Grandpa’s age is divisible by the age of only one child, but in one year’s time it will be divisible by the separate ages of three children, and also by the number in our family, while my own age will be divisible by the age of one child only (unity always excluded).”

    “During the year ahead on just one day in May, Grandpa’s age will be divisible by that of our son, whose birthday is earlier.”

    “From Grandpa downwards, what are our ages?”

    The following apology was published with Brain-Teaser 511:

    It is regretted that by a printing error the following words were omitted after “exactly equal”: “my own age. On the same day next year they will exactly equal”.

    I have inserted the missing text in the puzzle above.

    This puzzle was originally published with no title.

    [teaser508]

     
    • Jim Randell's avatar

      Jim Randell 2:22 pm on 5 November 2019 Permalink | Reply

      I wrote a program to solve the puzzle as originally stated (without the additional text) and found 15 solutions.

      So I created a MiniZinc model that makes it easy to play around with variations on the puzzle.

      When the constraints arising from the missing text are incorporated we get a single solution.

      %#! minizinc -a
      
      % grandpa and grandma are aged between 51 and 69
      var 51..69: gp;
      var 51..69: gm;
      
      % but the total is not more than 120
      constraint not(gp + gm > 120);
      
      % son's age
      var 18..51: son;
      
      % kids ages (0 for no kid)
      array[1..10] of var 0..16: kids;
      
      % kids are descending order, and all different
      constraint forall (i in 2..10) (kids[i] > 0 -> kids[i - 1] > kids[i]);
      
      % son + total of kids ages = gm [originally was = gp]
      constraint son + sum(kids) = gm;
      
      % son + total of kids ages in 1 year = gp, so: gp - gm = number of children
      % [originally this condition was omitted]
      constraint sum (i in 1..10) (kids[i] > 0) = gp - gm;
      
      % exactly 1 kid divides gp
      constraint sum (i in 1..10) (kids[i] > 1 /\ gp mod kids[i] = 0) = 1;
      
      % but exactly 3 kids divide gp in 1 year
      constraint sum (i in 1..10) (kids[i] > 0 /\ (gp + 1) mod (kids[i] + 1) = 0) = 3;
      
      % and exactly 1 kid divides gm in 1 year
      constraint sum (i in 1..10) (kids[i] > 0 /\ (gm + 1) mod (kids[i] + 1) = 0) = 1;
      
      % also the number of kids + 1 divides into gp in 1 year
      constraint (gp + 1) mod (1 + sum (i in 1..10) (kids[i] > 0)) = 0;
      
      % (son + 1) divides gp
      constraint gp mod (son + 1) = 0;
      
      % at least 16 years between generations
      constraint son + 16 < min([gp, gm]);
      constraint max(kids) + 16 < son;
      
      solve satisfy;
      

      And we can format the output with Python 3 by using the minizinc.py wrapper:

      from minizinc import MiniZinc
      
      for (gp, gm, son, kids) in MiniZinc("teaser508.mzn").solve(result="gp gm son kids"):
        kids = list(x for x in kids.values() if x > 0)
        print(f"Grandpa = {gp}; Grandma = {gm}; Son = {son}; Children = {kids}")
      

      So the answer to the corrected puzzle is:

      Solution: Grandpa = 62; Grandma = 56; Son = 30; Children = 8, 6, 5, 4, 2, 1.

      Without the constraints to enforce a 16 year gap between generations we can have a further solution (with 7 children):

      Grandpa = 63; Grandma = 56; Son = 20; Children = 15, 6, 5, 4, 3, 2, 1

      Like

  • Unknown's avatar

    Jim Randell 9:52 am on 4 July 2019 Permalink | Reply
    Tags: by: Jean Harrison,   

    Brain-Teaser 484: [Family ages] 

    From The Sunday Times, 6th September 1970 [link]

    The total ages of my children, all of single birth, exactly equal my own age. On the same day next year they will exactly equal my husbands age.

    At present my husband’s age is divisible by the age of only one child, but in one year’s time it will be divisible by the separate ages of three children and also by the number of children in the family, while my own age will be divisible by the age of one child only.

    During the year ahead, on just one day in May, my husband’s age will be divisible by that of my eldest child.

    What are the children’s ages?

    Note: This puzzle is flawed, as there is not a single solution. A note was published with Brain-Teaser 485 saying that as there are three solutions no prize can be awarded.

    This puzzle was originally published with no title.

    [teaser484]

     
    • Jim Randell's avatar

      Jim Randell 9:54 am on 4 July 2019 Permalink | Reply

      I found many solutions to this puzzle, not just the 3 mentioned when Brain-Teaser 485 was published.

      The simplest solution was with 4 children with ages: 1, 2, 11, 18. This gives:

      The wife’s age is 32, the husband’s age is 35.

      Only 1 divides into 35, but next year (when the children are 2, 3, 12, 19 and the husband is 36) three of the children ages (2, 3, 12) will divide in 36.

      And the wife will be 33, and 3 divides into this.

      During May the eldest child’s age (18) does not divide into the husband’s age (35), until the husband’s birthday, when he is 36. The next day is the eldest child’s birthday, who become 19, which not divide the husband’s age.

      The problem with this solution is that at the time of birth of the eldest child the wife would be 14 and the husband 17. While not impossible, it’s probably not what the setter had in mind, so we’ll stick with more conventional scenarios.

      To make a version of the puzzle with a single solution I added a couple of extra conditions.

      Firstly I strengthened the “all of single birth” condition to the children all having different ages (in years), and restricted the current ages of the children to be between 2 and 16.

      This gets me down to 5 solutions (one with 5 children, and four with 7 children). Adding a further reasonable conditions such as “the husband and wife are both aged less than 50” or “the wife was in her twenties at the time of the birth of the eldest child” can be used to narrow the possibilities down to a single solution.

      So I settled on the following additional conditions to give a single solution:

      • The children are aged between 2 and 16, and their ages (expressed in years) are all different.
      • The husband and wife are currently aged less than 50.

      This Python program solves the revised puzzle. It runs in 159ms.

      Run: [ @repl.it ]

      from enigma import (subsets, irange, div, printf)
      
      # x is divisible by y
      divides = lambda x, y: div(x, y) is not None
      
      # consider sets of at least 3 children ([extra] with no repeated ages)
      for ages in subsets(irange(2, 16), min_size=3, select='C'):
        k = len(ages)
      
        # wife's current age is the sum
        w = sum(ages)
        # husbands age + 1 is w + k
        h = w + k - 1
      
        # [extra] husband and wife are less than 40
        if not (h < 50): continue
      
        # husbands current age is divisible by the age of only one child
        if not (sum(divides(h, x) for x in ages) == 1): continue
      
        # in 1 years time it is divisible by the ages of three children...
        if not (sum(divides(h + 1, x + 1) for x in ages) == 3): continue
        # ... and also the number of children ...
        if not divides(h + 1, k): continue
      
        # ... while the wifes age is divisible by only one child
        if not (sum(divides(w + 1, x + 1) for x in ages) == 1): continue
      
        # on one day the husbands age will divide the age of the eldest child
        # so their birthdays must be on consecutive days
        a = ages[-1]
        # so they don't divide in general either now or both incremented
        if divides(h, a) or divides(h + 1, a + 1): continue
        # but they do divide when one of them is incremented
        if not (divides(h + 1, a) or (divides(h, a + 1))): continue
      
        # output solution (w0 and h0 are ages at the birth of the first child)
        printf("k={k}, ages={ages}, w={w}, h={h} [{w0}, {h0}]", w0=w - a, h0=h - a)
      

      Solution: The children are aged: 3, 6, 7, 9, 10.

      The wife’s current age is 35 (the sum of the children’s ages). The husband’s current age is 39. (So they would be 25 and 29 at the birth of eldest child).

      Of the children’s current ages, only 3 divides into 39. But when the ages are all increased by one to 4, 7, 8, 10, 11 then 4, 8 and 10 divide into 40. And the wife will be 36, which is divisible by 4.

      During May the eldest child’s age (10) does not divide into the husband’s age (39), until the husband’s birthday, when he is 40. The next day is the eldest child’s birthday (11) and non-divisibility is resumed.

      The intended solution was apparently 1, 6, 7, 9, 12.

      Like

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
Design a site like this with WordPress.com
Get started