Sunday Times Teaser 2573 – Prime Cricketers
by Danny Roth
Published: 15 January 2012 (link)
George and Martha support their local cricket team and keep records of all the results. At the end of last season, they calculated the total number of runs scored by each of the 11 players. George commented that the totals were all different three figure palindromic primes. Martha added that the average of the 11 totals was also a palindromic prime.
What were the two highest individual totals?
One Comment
Leave one →
-
Brian Gladman permalink1234567891011121314151617from itertools import combinationsfrom number_theory import Primes# list three digit palindromic primespr = [p for p in Primes().range(100, 1000) if str(p) == str(p)[::-1]]# try all combinations of 11 such primesfor p11 in combinations(pr, 11):# form the averageaverage, r = divmod(sum(p11), 11)# ... and check it is a palindromic primeif not r and average in pr:fs = 'The two highest individual totals were {} and {}.'print(fs.format(*p11[9:]))