Archimedes' Cattle Problem

Classic Problem
The sun god had a herd of cattle consisting of bulls and cows, divided into $4$ herds according to their colour:
 * white
 * black
 * dappled
 * yellow.

(Accounts vary as to their actual colours, which are arbitrary.)

Among the bulls:


 * the number of white ones was one half plus one third the number of the black greater than the yellow
 * the number of the black ones was one quarter plus one fifth the number of the dappled greater than the yellow
 * the number of the dappled ones was one sixth and one seventh the number of the white greater than the yellow.

Among the cows:


 * the number of white ones was one third plus one quarter of the total black cattle
 * the number of the black ones was one quarter plus one fifth the total of the dappled cattle
 * the number of dappled cattle was one fifth plus one sixth the total of the yellow cattle
 * the number of the yellow cattle was one sixth plus one seventh the total of the white cattle.

What was the composition of the herd?

Solution
Let:
 * $W$ be the number of white bulls
 * $B$ be the number of black bulls
 * $D$ be the number of dappled bulls
 * $Y$ be the number of yellow bulls
 * $w$ be the number of white cows
 * $b$ be the number of black cows
 * $d$ be the number of dappled cows
 * $y$ be the number of yellow cows.

Then the conditions can be expressed as:

This is a set of $7$ simultaneous equations in $8$ variables, and thus indeterminate.

From $(1)$ to $(3)$ we can find:

Because $\gcd \set {891, 1580} = 1$, we have that $Y$ must be a multiple of $891$: $G$, say.

Hence:

Substituting into equations $(4)$ to $(7)$, we obtain:

Solving these $4$ equations gives:

Because $4657$ is a divisor of none of the numbers on the, it must be the case that
 * $4657 \divides G$

where $\divides$ denotes divisibility.

Hence the smallest solution is:

Also known as
This problem is also known as:


 * the bovinum problema (that is, cattle problem in Latin)


 * Archimedes' Reverse