The sum of the ages of my five daughters is 43. The ages of any two of them have a common factor greater than 1. How old are my daughters?
Not sure if it's unique, but this works:
15, 10, and triplets of 6 years old.
The common factors:
2, 3 and 5.
How I found it:
Starting from the fact that any two have a gcd greater than 1, I assumed that all three have exactly two small prime factors. I assumed at least 2 and 3 for those. Starting with 6, 6 and 10, I had 21 years left, which can come from 6 and 15.
Your daughters are
6, 6, 6, 10, and 15
It is obvious that the sum of those ages is 43. For each pair the common factors are:
gcd(6, 10) = 2, gcd(6, 15) = 3, gcd(10, 15) = 5, and gcd(6, 6) is obvious.
The only remaining question is whether that is the only possible solution. My first observation was that
43 is a prime thus the ages cannot all have a single prime factor in common.
I also realized that since each pair have a common factor
There must be at least 3 different prime factors involved such that each pair can share a factor without all three sharing a factor. (If there were only 2 factors involved one of them would have to be shared among all the daughters or there would be a pair of daughters not sharing a factor).
The smallest sum we can achieve is by using
The three smallest primes as factors making the possible ages 6, 10, and 15. And there would have to be three of age 6 for a total of five daughters. Any other approach will result in a larger sum than 43.
If we consider the new born option (the fact that 0 is divisible by any number :) ) I would add this [0,6,10,12,15] to (0,0,0,0,43).
But the only solution to this is the first one (6,6,6,10,15).
The way I found these solutions is by thinking in a brute force way and since the number of combinations is high, I wrote a program that took a minute or less to finish and gave me the desired output.