# The Archimedean Cattle problem

This ancient problem is a Diophantine equation (i.e. an equation with integer solutions) which can be posed as follows

The sun-god had a herd of cattle cinsisting of $W, B, Y, D$ (respectively, of white, black, yellow and dappled bulls and $w, b, y$ and $d$ cows of these shades. These numbers satify the following nine equations,

$W =(\large\frac{1}{2}\normalsize +\large\frac{1}{3}\normalsize )B + Y$     $B = (\large\frac{1}{4}\normalsize + \large\frac{1}{5}\normalsize )D + Y$     $D = (\large\frac{1}{6}\normalsize +\large\frac{1}{7}\normalsize )W + Y$
$w = (\large\frac{1}{3}\normalsize + \large\frac{1}{4}\normalsize ))(B+b)$     $b = (\large\frac{1}{4}\normalsize + \large\frac{1}{5}\normalsize )(D+d)$
$d = (\large\frac{1}{5}\normalsize + \large\frac{1}{6}\normalsize )((Y+y)$     $y = (\large\frac{1}{6}\normalsize + \large\frac{1}{7}\normalsize ) (W+w)$

The smallest solution to this set of (linear) equations gives a total of 50,389,082 cattle.

Archimedes says that if you can solve this you
wouldst not be called unskilled or ignorant of numbers, but not yet shalt thou be numbered among the wise.
In addition one demands that $W+B$ is a square number and $Y+D$ is a tringular number.

One can (eventually) reduce these to solving the Pell's equation

$u^{2} - 4729494 v^{2} = 1$ and the continued fraction method gives

$u = 109931986732829734979866232821433543901088049$,
$v = 5054948525234315033074477819735540408986340$
leading to a solution to the original problem with more than 200 000 digits.

If you have solved this, Archimedes says you
shalt depart crowned with glory and knowing that thou hast been adjudged perfect in this species of wisdom.