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

Home > Numbers
3 Families (Posted on 2024-05-22) Difficulty: 3 of 5
Three families make a remarkable discovery. The sums of the ages of their members are all the same, the sums of the squares of the ages of their members are all the same, and the sums of the cubes of the ages of their members are all the same.

Everyone in all 3 families has a different age, and nobody is more than 100 years old.

What is the smallest possible sum of their ages? Can this be done with 4 families?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts Computer exploration | Comment 1 of 3
Apparently it can. Here are four families of 4 that have the desired property:

Family 1: 48, 25, 24, 1
Family 2: 46, 34, 15, 3
Family 3: 45, 36, 13, 4
Family 4: 43, 39, 10, 6

Each family has:
* sum of ages = 98
* sum of squares of ages = 3506
* sum of cubes of ages = 140042

There are a total of 455 sets of 4 families of 4 with matching sums. 
Every family of 3 with distinct ages less than 100 has a unique trio of sum, sum of squares, and sum of cubes. Ditto for families of two. 

The smallest sum I was able to find for three similarly summed families of 4 is 54 with these families:
Family 1: 26,16,11,1
Family 2: 25,19,8,2
Family 3: 23, 22, 5, 4

But there is another. There are cases with two families of 4 and one family of three that meet the criteria. The set with the smallest sum of ages is:

Family1: 24, 18, 7, 1
Family2: 22, 21, 4, 3
Family3: 25, 15, 10

All three families have sum of ages = 50, sum of squares of ages = 950 and sum of cubes of ages = 20000

Finally, it might be that there's a case with at least one family of 5 or more that somehow has an even lower sum of ages, but that seems unlikely. The more family members, the lower the average age will be, and the less room to make them all unique. For example, a family with 11 members necessarily has a sum of ages greater than the best case above, 50. 

Here's the code I used to solve the case where everyone's in a family of 4, and to check the case where there's a mix of familys of 3 and 4. I've added comments since Ruby isn't a super common language on perplexus:

# build all sets of 4 ages with no duplicates
nums = []
(1..100).each do |i| 
  (i+1..100).each do |j| 
    (j+1..100).each do |k| 
      (k+1..100).each do |l| 
        nums << [i,j,k,l]
      end
    end
  end
end
# collect into a hash whose keys are the "sum signature" and whose values are arrays of sets of family ages
# two sets ending up in the same hash element have the same sums of ages, squares of ages, and cubes of ages
data = Hash.new([])
nums.each do |n| 
  key = [n.sum, n.map{|x| x**2}.sum, n.map{|x| x**3}.sum].join('-')
  data[key] += [n]
end
# now find the hash keys with 3 or more values, since each value is a family with those stats
answer = data.select { |k,v| v.count >= 3 }
# the ones with 4 families
four = answer.select { |k,v| v.count >= 4 } # 455 such cases
# the smallest sum of ages
minimum_sum = answer.keys.map { |k| k.split('-').first.to_i }.min
# for 3-member families
nums3 = []
(1..100).each do |i| 
  (i+1..100).each do |j| 
    (j+1..100).each do |k| 
        nums3  << [i,j,k]
      end
    end
  end
end
data3 = Hash.new([])
nums3.each do |n| 
  key = [n.sum, n.map{|x| x**2}.sum, n.map{|x| x**3}.sum].join('-')
  data3[key] += [n]
end
# keys in common where there are at least 2 families of 4
common = data3.keys.select { |k| data.key?(k) && data[k].count > 1 }
# min sum of mixed-size families' ages
minimum_sum_mixes = common.keys.map { |k| k.split('-').first.to_i }.min









  Posted by Paul on 2024-05-24 02:27:18
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information