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

Home > Numbers
Family ages (Posted on 2019-04-16) Difficulty: 3 of 5
Three families make a remarkable discovery. The sum of the ages of their members are all the same, the sum of the squares of the ages of their members are all the same, and the sum 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?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution soln to first part Comment 4 of 4 |
Three satisfying families have ages:

(14 25 11 12 13), (19 23 2 6 10 15), (20 22 3 5 9 16)
with summed: ages, sq. ages, cubed ages = 75, 1255, 23625

An alternate second family: (17 24 1 8 10 15) also works.

I have not found a four family solution, but have decided to not continue searching until a clearer definition of "family" is made.

For the solution above,  I used the constraints I mentioned in my first post but limited the number of children to be <=4.

The code is here:

program s66

        implicit none

        integer i1,i2,i3,i4,i5,i6,j1,j2,j3,j4,j5,j6,

        1 jjj1,jjj2,jjj3,jjj4,jjj5,jjj6,

        2 sumi,sumii,sumiii,sumj,sumjj,sumjjj,j,cnt,dcnt 

        cnt=0

        dcnt=0

         do 12 i1=14,100

c       print*,'i1 = ',i1

          do 11 i2=i1+1,100

           do 10 i3=0,i1-1

           if(i3.ge.i1.or.i3.ge.i2)go to 10 

            do  9 i4=0,i1-1

            if(i4.ge.i1.or.i4.ge.i2)go to 9

            if(i3+i4.ne.0.and.i4.le.i3)go to 9

             do  8 i5=0,i1-1

             if(i5.ge.i1.or.i5.ge.i2)go to 8

             if(i3+i4+i5.ne.0.and.(i5.le.i4.or.i5.le.i3))go to 8

              do  7 i6=i5+1,i1-1

              if(i6.ge.i1.or.i6.ge.i2)go to 7

              if(i3+i4+i5+i6.ne.0.and.

        1     (i6.le.i5.or.i6.le.i4.or.i6.le.i3))go to 7

              sumi=  i1   +i2   +i3   +i4   +i5   +i6

              sumii= i1**2+i2**2+i3**2+i4**2+i5**2+i6**2

              sumiii=i1**3+i2**3+i3**3+i4**3+i5**3+i6**3


         do  6 j1=14,100

c       print*,'j1= ',j1

         j=j1

         jjj1=j**3

         if(jjj1.gt.sumiii) go to 7

         if(j.eq.i1.or.j.eq.i2.or.j.eq.i3

        1.or.j.eq.i4.or.j.eq.i5.or.j.eq.i6)go to 6

          do  5 j2=j1+1,100

          j=j2

          jjj2=j**3

          if(jjj1+jjj2.gt.sumiii) go to 7 

          if(j.eq.i1.or.j.eq.i2.or.j.eq.i3

        1 .or.j.eq.i4.or.j.eq.i5.or.j.eq.i6)go to 5

           do  4 j3=0,j1-1

           j=j3

           jjj3=j**3

           if(jjj1+jjj2+jjj3.gt.sumiii) go to 7

           if(j.ge.j1.or.j.ge.j2)go to 4

           if(j.ne.0.and.(j.eq.i1.or.j.eq.i2.or.j.eq.i3

        1  .or.j.eq.i4.or.j.eq.i5.or.j.eq.i6))go to 4

            do  3 j4=0,j1-1

            j=j4

            jjj4=j**3

            if(jjj1+jjj2+jjj3+jjj4.gt.sumiii) go to 7

            if(j.ge.j1.or.j.ge.j2)go to 3

            if(j.ne.0.and.(j.eq.i1.or.j.eq.i2.or.j.eq.i3

        1   .or.j.eq.i4.or.j.eq.i5.or.j.eq.i6))go to 3

            if(j3+j4.ne.0.and.j4.le.j3)go to 3

         do  2 j5=0,j1-1

             j=j5

             jjj5=j**3

             if(jjj1+jjj2+jjj3+jjj4+jjj5.gt.sumiii) go to 7

             if(j.ge.j1.or.j.ge.j2)go to 2

             if(j.ne.0.and.(j.eq.i1.or.j.eq.i2.or.j.eq.i3

        1    .or.j.eq.i4.or.j.eq.i5.or.j.eq.i6))go to 2

             if(j3+j4+j5.ne.0.and.(j5.le.j4.or.j5.le.j3))go to 2

              do  1 j6=j5+1,j1-1

              j=j6

              jjj6=j**3

              sumjjj=jjj1+jjj2+jjj3+jjj4+jjj5+jjj6

              if(sumjjj.gt.sumiii) go to 7

              if(j.ge.j1.or.j.ge.j2)go to 1

              if(j.ne.0.and.(j.eq.i1.or.j.eq.i2.or.j.eq.i3

        1     .or.j.eq.i4.or.j.eq.i5.or.j.eq.i6))go to 1

               if(j3+j4+j5+j6.ne.0.and.

        1      (j6.le.j5.or.j6.le.j4.or.j6.le.j3))go to 1

              cnt=cnt+1

                if(cnt.gt.1000000000)then

                cnt=0

                dcnt=dcnt+1

           print 100,dcnt,i1,i2,i3,i4,i5,i6,j1,j2,j3,j4,j5,j6,sumiii,sumjjj

100        format(i6,3x,2(6(i3,1x),6x)2(i10,1x))

           endif

               sumj=  j1   +j2   +j3   +j4   +j5   +j6

               if(sumi.ne.sumj)goto 1

               sumjj= j1**2+j2**2+j3**2+j4**2+j5**2+j6**2

               if(sumii.ne.sumjj)go to 1

               if(sumiii.ne.sumjjj)go to 1

               print 101,i1,i2,i3,i4,i5,i6,j1,j2,j3,j4,j5,j6

101            format('soln ',3x,2(6(i3,1x),6x))

               print*,sumi,sumii,sumiii

1              enddo

2            enddo

3           enddo

4          enddo

5         enddo

6        enddo

7             enddo

8            enddo

9           enddo

10         enddo

11        enddo

12       enddo

        end

The winning rows were the "B" rows below.

soln     16  20   5   9  10  15        14  21   4  11  12  13  A

          75        1087       17325

soln     17  19   6   8   9  16        14  21   4  11  12  13  A

          75        1087       17325

soln     17  22   1   6  11  12        14  23   0   9  10  13 

          69        1075       18837

soln     17  24   1   8  10  15        14  25   0  11  12  13  B

          75        1255       23625

soln     17  26   0   3   4  15        14  27   0   0  11  13  

          65        1215       25955

soln     17  26   3   7   9  16        14  27   1  11  12  13  C

          78        1360       27684

soln     18  19   6   7   8  17        14  22   3  11  12  13  D

          75        1123       18675

soln     18  20   5   7  10  15        14  22   3  11  12  13  D

          75        1123       18675

soln     18  22   0   8   9  11        14  23   0   6  12  13

          68        1074       19052

soln     18  24   4   5   6  17        14  26   0   9  12  13

          74        1266       24974

soln     18  25   0   2   4  11        14  26   0   0   7  13

          60        1090       22860

soln     18  29   5   6   7  16        14  30   1  11  12  13  E

          81        1531       35001

soln     18  30   4   5   7  16        14  31   0  10  12  13

          80        1570       37460

soln     19  21   4   6   8  17        14  24   1  11  12  13  F

          75        1207       21825

soln     19  23   2   6  10  15        14  25   0  11  12  13  B

          75        1255       23625

soln     19  28   0   2   5   9        14  29   0   0   7  13

          63        1255       29673

soln     20  21   4   5   7  18        14  25   0  11  12  13  B

          75        1255       23625

soln     20  21   4   5  10  15        14  24   1  11  12  13  F

          75        1207       21825

soln     20  22   3   5   9  16        14  25   0  11  12  13  B

          75        1255       23625

soln     20  25   5   6   7  15        14  27   1  11  12  13  C

          78        1360       27684

soln     20  30   0   5   7  10        14  31   0   2  12  13

          72        1474       36468

soln     20  30   1   7   8   9        14  31   0   5  12  13

          75        1495       36585

soln     20  31   0   2   8   9        14  32   0   0  11  13

          70        1510       39040

soln     21  34   0   5   7   8        14  35   0   1  12  13

          75        1735       49545

soln     21  35   0   4   6   8        14  36   0   0  11  13

          74        1782       52928

soln     21  36   1   4   5   6        14  37   0   0   9  13

          73        1815       56323

soln     22  28   0   5   6   9        14  30   0   1  12  13

          70        1410       33670

soln     24  28   0   5   6   7        14  31   0   0  12  13

          70        1470       36460

soln     25  26   6   7   8   9        14  30   1  11  12  13  E

          81        1531       35001

Edited on April 20, 2019, 7:04 am
  Posted by Steven Lord on 2019-04-19 16:37:45

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 (12)
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