Sunday Times Teaser 2698 – Pond Plants
by Graham Smithers
John bought three types of pond plant – oxygenating, floating and lilies – sold in packs of eight, four and two respectively. All the packs were the same price and he ended up with the same number of plants of each type. He then recovered his costs by selling some of the packs for 25% more than they cost, leaving himself with exactly 50 plants among which lilies were the least in number.
How many of these 50 plants were lilies?
One Comment
Leave one →
-
brian gladman permalink12345678910111213141516171819202122232425262728# packs of oxygenating plants: bought X, x left after sale# packs of floating plants: bought F, f left after sate# packs of lilies: bought L, l left after sale## plants of each type = 8X = 4F = 2L# total plants bought = 8X + 4F + 2L = 24X# cost (pack cost P) = (X + F + L)P = 7XP## plants left: 8x + 4f + 2l = 50# income: (5/4)((X + F + L) - (x + f + l))P# income = cost ==> x + f + l = 7(X/5)# plants left ==> 4x + 2f + l = 25# packs of oxygenating plants leftfor x in range(7):# packs of floating plants left - note that the# above equations show that f = (4x + 4) mod 7for f in range((4 * x + 4) % 7, 13 - 2 * x, 7):# packs of lilies leftl = 25 - 4 * x - 2 * f# x + f + l must be a multiple of 7if (x + f + l) % 7 == 0:# there are less lilies than other plantsif l < min(4 * x, 2 * f):print('There are {} lilies left.'.format(2 * l))