This is a famous problem of intermediate analysis, also known as ‘Archimedes’ Cattle Problem Puzzle’, sent by Archimedes to Eratosthenes as a challenge to Alexandrian scholars. In it one is required to find the number of bulls and cows of each of four colors, the eight unknown quantities being connected by nine conditions. These conditions ultimately form a Pell equation which solution is necessary in case of finding the answer of the puzzle. The Greek puzzle is stated below with a little deviation. I have just tried to make the language simpler than the original, hope you’ll be able to grasp the puzzle easily.
O Stranger! If you are intelligent and wise, find the number of cattle of the Sun, who once upon a time grazed on the fields of an Island, divided into four groups (herds) of different colors, one white, another a black, a third yellow and the last dappled color.In each herd were bulls, mighty in number according to these proportions:
 White bulls were equal to a half and a third of the black together with the whole of the yellow.
 The black bulls were equal to the fourth part of the dappled and a fifth, together with, once more, the whole of the yellow.
 The dappled bulls, were equal to a sixth part of the white and a seventh, together with all of the yellow.
So, these were the proportions of bulls, now the proportions of the cows were as following:
 White cows were equal to the third part and a fourth of the whole herd of the black.
 Black cows were equal to the fourth part once more of the dappled and with it a fifth part, when all cattle, including the bulls, went to pasture together. Now the dappled in four parts were equal in number to a fifth part and a sixth of the yellow herd.
 Yellow cows were in number equal to a sixth part and a seventh of the white herd.
Keeping above conditions in focus, find the number of cattle of the Sun, giving separately the number of wellfed bulls and again the number of females according to each color. But come, this solution is not complete unless you understand all these conditions regarding the cattle of the Sun:
 When the white bulls mingled their number with the black, they stood firm, equal in depth and breadth. Number of bulls in a row were equal to the number of columns.
 When the yellow and the dappled bulls were gathered into one herd they stood in such a manner that their number, beginning from one, grew slowly greater till it completed a triangular figure, there being no bulls of other colors in their midst nor none of them lacking.
Find the number of cows and bulls of each color separately.
$ W$ 
=  number of white bulls 
$ B$  =  number of black bulls 
$ Y$  =  number of yellow bulls 
$ D$  =  number of dappled bulls 
$ w$  =  number of white cows 
$ b$  =  number of black cows 
$ y$  =  number of yellow cows 
$ d$  =  number of dappled cows 
The relations come as:

 $ W = (\frac{1}{2} + \frac{1}{3})B + Y$ The white bulls were equal to a half and a third of the black bulls together with the whole of the yellow bulls.
 $ B = (\frac{1}{4} + \frac{1}{5})D + Y$ The black [bulls] were equal to the fourth part of the dappled bulls and a fifth, together with, once more, the whole of the yellow bulls
 $ D = (\frac{1}{6} + \frac{1}{7})W + Y$ The remaining bulls, the dappled, were equal to a sixth part of the white bulls and a seventh, together with all of the yellow bulls
 $ w = (\frac{1}{3} + \frac{1}{4})(B + b)$ The white cows were equal to the third part and a fourth of the whole herd of the black.
 $ b = (\frac{1}{4} + \frac{1}{5})(D + d)$ The black cows were equal to the fourth part once more of the dappled and with it a fifth part, when all, including the bulls, went to pasture together.
 $ d = (\frac{1}{5} + \frac{1}{6})(Y + y)$ the dappled cows in four parts [in totality] were equal in number to a fifth part and a sixth of the yellow herd.
 $ y = (\frac{1}{6} + \frac{1}{7})(W + w)$ the yellow cows were in number equal to a sixth part and a seventh of the white herd.
The arrangement on solving gives following relations in W,B,D,Y,w,b,d and y. which is a system of seven equations with eight unknowns. It is indeterminate, and has infinitely many solutions and form the following matrix:
6  5  6  0  0  0  0  0  
0  20  20  9  0  0  0  0  
13  0  42  42  0  0  0  0  
0  7  0  0  12  7  0  0  
0  0  0  9  0  20  0  9  
0  0  11  0  0  0  11  30  
13  0  0  0  13  0  42  0 
Which yields the following solutions
W  =  10,366,482k 
B  =  7,460,514k 
Y  =  4,149,387k 
D  =  7,358,060k 
w  =  7,206,360k 
b  =  4,893,246k 
y  =  5,439,213k 
d  =  3,515,820k 
where $ k$ is an arbitrary constant, which can be equal to either 1 or 2 or 3 … etc. Again, from the second part of the problem:
 White bulls + black bulls = a square number, $ W+B=10366482k +7460514k$= a square number. or $ W+B=17,826,996k$ =a square number$ 2 \cdot 2\cdot 3 \cdot 11 \cdot 29 \cdot 4657 k = \textrm{a square number}$ . Thus $ k$ atleast be $ 3 \cdot 11 \cdot 29 \cdot 4657 $ or in general be $ 3\cdot 11\cdot 29 \cdot 4657 \cdot r^2=4456749r^2$ where $ r$ is any integer. Again, Dappled bulls + yellow bulls = a triangular number.or, $ Y + D = \textrm{a triangular number}$ where triangular numbers are numbers of the form $ 1 + 2 + 3 + 4 + 5 + \ldots + m =\frac{m(m+1)}{2}$ . where $ m$ is some positive integer. Thus $ 4,149,387k + 7,358,060k =\frac{m(m+1)}{2}$ or $ 11,507,447k =\frac{m(m+1)}{2}$ . Putting $ k=4456749 r^2$ we have $ 11,507,447 \times 4,456,749 r^2 = \frac{m(m+1)}{2}$ or $ 102,571,605,819,606 r^2 = m(m + 1)$ . The problem is now to find the values of $ r$ and $ m$ that we can find the value of $ k$ and thus the solution of the problem.
 The computer generated answers for smallest solutions are at my Pastebin Account.
 Recently, Ilan Vardi of Occidental College (Los Angeles, California, USA) developed simple explicit formulas to generate solutions to the cattle problem.Click here to read his paper on the cattle problem.

References and Further Readings: Weisstein, Eric W. “Archimedes’ Cattle Problem.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/ArchimedesCattleProblem.html Archimedes’s Cattle Problem http://gauravtiwari.org/?s=Archimedes%27_cattle_problem Archemedes’s Cattle Problem http://math.nyu.edu/~crorres/Archimedes/Cattle/Statement.html The Archemedes’s Cattle Problem http://www.maa.org/devlin/devlin_02_04.html
Just popping in to say hello and to thank you for your help with my query in the WP forum.