Sunday Times Teaser 2575 – More Teams
by Andrew Skidmore
Published: 29 January 2012 (link)
In our local pub soccer league each team plays each of the others at home and away during the season. Two seasons ago we had a two-figure number of teams. The number increased the next year, and again this year, but this time the increase was one less than the previous season. This season the number of games played will be over three times the number played two seasons ago. Also, this season’s increase in games played actually equals the number played two seasons ago.
How many teams are there now in the league?
One Comment
Leave one →
-
Brian Gladman permalink12345678910111213141516171819202122from itertools import count# the N teams play N * (N - 1) matches in a season# the number of teams two years agofor n1 in range(10, 100):# the games played two years agop1 = n1 * (n1 - 1)# the increase in the number of teams last yearfor i in range(1, 10):# the number of teams last year and this yearn2, n3 = n1 + i, n1 + 2 * i - 1# the games played last and this seasonp2, p3 = n2 * (n2 - 1), n3 * (n3 - 1)if p3 > 3 * p1 and p3 - p2 == p1:print('There are {} Teams this year.'.format(n3))