Each of the 11 players on the Prime Time soccer team was identified by a different prime number less than 45 on his jersey. The average of those primes was also a prime different from each of those of the players. What were the players' identifying numbers?
this program first creates a list of all primes less than 45, then it goes through all possible choices of 3 different primes from that list. These 3 represent the 3 primes not used for the players. Then to get the players average I simply subtracted their sum from the total sum. I then tested if the average was prime and printed the 3 primes and the average if it was. Of the 3 results only the first gives a prime average that is not a team number.
thus the team numbers are
5,7,11,13,17,19,29,31,37,41,43 with average 23
Pr={};
For[i=2,i<45,i++,
If[PrimeQ[i],
Pr=Append[Pr,i]];
];
lng=Length[Pr];
tot=Total[Pr];
For[i1=1,i1£12,i1++,
For[i2=i1+1,i2£13,i2++,
For[i3=i2+1,i3£14,i3++,
p1=Pr[[i1]];
p2=Pr[[i2]];
p3=Pr[[i3]];
v=p1+p2+p3;
avg=(tot-v)/11;
If[PrimeQ[avg],
Print[p1,",",p2,",",p3,",",avg];
];
];
];
];
this returns
2,3,23,23
2,7,19,23
2,29,41,19
|
Posted by Daniel
on 2009-02-19 11:55:21 |