Challenge Level

One cake + one bun = 23p + 39p = 62p

512 $\div$ 62 = 8 remainder 16, so buying 8 cakes and 8 buns costs 16p less

16 = 39 - 23 is the difference between them

So buy one more bun and one less cake

7 cakes and 9 buns

$23a$ $+$ $39b$ $=$ $512$

Those numbers are not very easy to work with so try writing it differently...

$23(a+b)$ $+\underbrace{16b}_{\text{multiple

of 16}}=\underbrace{512}_{\text{multiple

of 16}}$

So $(a+b)$ must be a multiple of $16$ as well.

Try $a+b=16$

$23\times16$ $+$ $16b$ $=$ $512$

$ 368$ $ +$ $ 16b$ $ =$ $ 512$

$16b = 512 - 386 = 144$

$144=9\times16$ so $b=9$ and so $a=7$

This problem is taken from the UKMT Mathematical Challenges.

You can find more short problems, arranged by curriculum topic, in our short problems collection.