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,DW, B, Y, D (respectively, of white, black, yellow and dappled bulls and w,b,yw, b, y and dd cows of these shades. These numbers satify the following nine equations,

W=(12+13)B+YW =(\large\frac{1}{2}\normalsize +\large\frac{1}{3}\normalsize )B + Y     B=(14+15)D+YB = (\large\frac{1}{4}\normalsize + \large\frac{1}{5}\normalsize )D + Y     D=(16+17)W+YD = (\large\frac{1}{6}\normalsize +\large\frac{1}{7}\normalsize )W + Y
w=(13+14))(B+b)w = (\large\frac{1}{3}\normalsize + \large\frac{1}{4}\normalsize ))(B+b)     b=(14+15)(D+d)b = (\large\frac{1}{4}\normalsize + \large\frac{1}{5}\normalsize )(D+d)
d=(15+16)((Y+y)d = (\large\frac{1}{5}\normalsize + \large\frac{1}{6}\normalsize )((Y+y)     y=(16+17)(W+w)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+BW+B is a square number and Y+DY+D is a tringular number.

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

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

u=109931986732829734979866232821433543901088049u = 109931986732829734979866232821433543901088049,
v=5054948525234315033074477819735540408986340v = 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.