## Teaser 2974: Flockbuster

**From The Sunday Times, 22nd September 2019** [link]

Wu, Xi, Yo and Ze had different two-figure numbers of sheep and kept them in a walled field divided by fences into a fold each. Maths whizz, Wu, with the largest flock, noticed that together her flock and Ze’s equalled Xi’s and Yo’s combined; and that, as a fraction, the ratio of Yo’s flock to Xi’s had consecutive upper and lower numbers (e.g. 3/4), whereas her flock to Xi’s ratio had those numbers swapped over (e.g. 4/3).

Overnight, storm-damaged fences led to the same number of sheep in each fold. Wu’s old maths teacher, told just this number and the above relationships, couldn’t be certain how many sheep Wu owned (which would have been true, also, if he’d been told either fraction instead).

How many sheep did Wu own?

[teaser2974]

## Jim Randell 12:07 am

on21 September 2019 Permalink |This Python program considers possible values for X and Y, from which the values of W and Z (and k) can be derived. It runs in 88ms.

Run:[ @repl.it ]Solution:Wu owns 99 sheep.There are 12 possible values for W, X, Y, Z that fit the description. Here they are are by the total number of sheep, and the value of

k, the numerator of the fraction:We see that the total number of sheep is only ambiguous when

t= 220 (cases 8, 9). So the teacher can narrow down the situation to one of those two cases (all other values oftuniquely identify a single case).And the value of

kis ambiguous when:k= 2 (cases 6, 9)k= 3 (cases 2, 5, 10)k= 4 (case 1, 3, 7)k= 6 (cases 4, 12)And case 9 is the only one common to both scenarios so this is the required solution:

W=99 Z=11, X=66 Y=44.So

W + Z = X + Y = 110andY/X = X/W = 2/3.LikeLike

## Jim Randell 3:06 pm

on22 September 2019 Permalink |Here’s a slightly shorter program that considers values for

X, and derives possible values forW, Y, Z, k, tfrom that.Since we know:

We also know that:

So

YandWare divisor pairs ofX², andY < X < W.We can then also calculate

Zandkand check they satisfy the remaining conditions.Run:[ @repl.it ]LikeLike