At the end of a soccer season, every player on a team scored a prime number of goals, and the average for the team as a whole was also a prime number. No player’s tally was equal to another’s, and no player’s tally was the same as the average.
Given that nobody scored more than 45 goals, how many goals did each player score?
*** There are 11 players in a soccer team.
The largest prime not exceeding 45 is the 14th prime, 43, so to get the total of all the players' scores we just need the total of the first 14 primes and subtract out three of these primes.
10 for I=1 to 14:First14=First14+prm(I):next
20 for LeaveOut1=1 to 12
30 for LeaveOut2=LeaveOut1+1 to 13
40 for LeaveOut3=LeaveOut2+1 to 14
90 Sum=First14-prm(LeaveOut1)-prm(LeaveOut2)-prm(LeaveOut3)
100 Avg=Sum//11
110 if Avg=int(Avg) then if prmdiv(Avg)=Avg then
120 :if Avg=prm(LeaveOut1) or Avg=prm(LeaveOut2) or Avg=prm(LeaveOut3) then
150 :for I=1 to 14
160 :if I<>LeaveOut1 and I<>LeaveOut2 and I<>LeaveOut3 then
170 :print prm(I);:endif
180 :next
190 :print:print Avg
200 next:next:next
which finds these individual players' scores
5 7 11 13 17 19 29 31 37 41 43
which average
23
|
Posted by Charlie
on 2013-04-17 12:37:57 |