Archimedes' cattle problem (or the problema bovinum or problema Archimedis) is a problem in Diophantine analysis, the study of polynomial equations with integer solutions. Attributed to Archimedes, the problem involves computing the number of cattle in a herd of the sun god from a given set of restrictions. The problem was discovered by Gotthold Ephraim Lessing in a Greek manuscript containing a poem of fortyfour lines, in the Herzog August Library in Wolfenbüttel, Germany in 1773.
The problem remained unsolved for a number of years, due partly to the difficulty of computing the huge numbers involved in the solution. The general solution was found in 1880 by A. Amthor; he gave the exact solution using exponentials and showed that it was about cattle. The decimal form is too long for humans to calculate exactly, but multiple precision arithmetic packages on computers can easily write it out explicitly.
Contents 
In 1769, Gotthold Ephraim Lessing was appointed librarian of the Herzog August Library in Wolfenbüttel, Germany, which contained many Greek and Latin manuscripts.^{[1]} A few years later, Lessing published translations of some of the manuscripts with commentaries. Among them was a Greek poem of fortyfour lines, containing an arithmetical problem which asks the reader to find the number of cattle in the herd of the god of the sun. The name of Archimedes appears in the title of the poem, it being said that he sent it in a letter to Eratosthenes to be investigated by the mathematicians of Alexandria. The claim that Archimedes authored the poem is disputed, though, as no mention of the problem has been found in the writings of the Greek mathematicians.^{[2]}
The problem, from an abridgement of the German translations published by Nesselmann in 1842, and by Krumbiegel in 1880, states:
Compute, O friend, the number of the cattle of the sun which once grazed upon the plains of Sicily, divided according to color into four herds, one milkwhite, one black, one dappled and one yellow. The number of bulls is greater than the number of cows, and the relations between them are as follows:
If thou canst give, O friend, the number of each kind of bulls and cows, thou art no novice in numbers, yet can not be regarded as of high skill. Consider, however, the following additional relations between the bulls of the sun:
 White bulls black bulls + yellow bulls,
 Black bulls dappled bulls + yellow bulls,
 Dappled bulls white bulls + yellow bulls,
 White cows black herd,
 Black cows dappled herd,
 Dappled cows yellow herd,
 Yellow cows white herd.
If thou hast computed these also, O friend, and found the total number of cattle, then exult as a conqueror, for thou hast proved thyself most skilled in numbers.^{[2]}
 White bulls + black bulls = a square number,
 Dappled bulls + yellow bulls = a triangular number.
The first part of the problem can be solved readily by setting up a system of equations. If the number of white, black, dappled, and yellow bulls are written as W,B,D, and Y, and the number of white, black, dappled, and yellow cows are written as w,b,d, and y, the problem is simply to find a solution to:
which is a system of seven equations with eight unknowns. It is indeterminate, and has infinitely many solutions. The least positive integers satisfying the seven equations are:
which is a total of 50,389,082k cattle^{[2]} and the other solutions are integral k multiples of these. Note that the first four numbers are multiples of 4657, a value which will appear repeatedly below.
The general solution to the second part of the problem was first found by A. Amthor^{[3]} in 1880. The following version of it was described by H. W. Lenstra ^{[4]}, based on Pell's equation: the solution given above for the first part of the problem should be multiplied by
where
and j is any positive integer. Equivalently, squaring w results in,
where {u,v} are the fundamental solutions of the Pell equation,
The size of the smallest herd that could satisfy both the first and second parts of the problem is then given by j = 1, and is about (first solved by Amthor). Modern computers can easily print out all digits of the answer. This was first done at the University of Waterloo, in 1965 by H. C. Williams, R. A. German, and C. R. Zarnke. They used a combination of the IBM 7040 and IBM 1620 computers.
The constraints of the second part of the problem are straightforward and the actual Pell equation that needs to be solved can easily be given. First, it asks that B+W should be a square, or using the values given above,
thus one should set k = (3)(11)(29)(4657)q^{2} for some integer q. That solves the first condition. For the second, it requires that D+Y should be a triangular number,
Solving for t,
Substituting the value of D+Y and k and finding a value of q^{2} such that the discriminant of this quadratic is a perfect square p^{2} entails solving the Pell equation,
Amthor's approach discussed in the previous section was essentially to find the smallest v such that it is integrally divisible by 2*4657. The fundamental solution of this equation has more than 100,000 digits but can be solved by online software such as Dario Alpern's "Quadratic TwoVariable Equation Solver" in about 50 seconds.
Archimedes' cattle problem (or the problema bovinum or problema Archimedis) is a problem in Diophantine analysis, the study of polynomial equations with integer solutions. Attributed to Archimedes, the problem involves computing the number of cattle in a herd of the sun god from a given set of restrictions. The problem was discovered by Gotthold Ephraim Lessing in a Greek manuscript containing a poem of fortyfour lines, in the Herzog August Library in Wolfenbüttel, Germany in 1773.
The problem remained unsolved for a number of years, due partly to the difficulty of computing the huge numbers involved in the solution. The general solution was found in 1880 by A. Amthor; he gave the exact solution using exponentials and showed that it was about $7.76\; \backslash times\; 10^\{206544\}$ cattle. The decimal form is too long for humans to calculate exactly, but multiple precision arithmetic packages on computers can easily write it out explicitly.
Contents 
In 1769, Gotthold Ephraim Lessing was appointed librarian of the Herzog August Library in Wolfenbüttel, Germany, which contained many Greek and Latin manuscripts.^{[1]} A few years later, Lessing published translations of some of the manuscripts with commentaries. Among them was a Greek poem of fortyfour lines, containing an arithmetical problem which asks the reader to find the number of cattle in the herd of the god of the sun. The name of Archimedes appears in the title of the poem, it being said that he sent it in a letter to Eratosthenes to be investigated by the mathematicians of Alexandria. The claim that Archimedes authored the poem is disputed, though, as no mention of the problem has been found in the writings of the Greek mathematicians.^{[2]}
The problem, from an abridgement of the German translations published by Nesselmann in 1842, and by Krumbiegel in 1880, states:
Compute, O friend, the number of the cattle of the sun which once grazed upon the plains of Sicily, divided according to color into four herds, one milkwhite, one black, one dappled and one yellow. The number of bulls is greater than the number of cows, and the relations between them are as follows:If thou canst give, O friend, the number of each kind of bulls and cows, thou art no novice in numbers, yet can not be regarded as of high skill. Consider, however, the following additional relations between the bulls of the sun:
 White bulls $=\backslash left(\backslash frac\{1\}\{2\}\; +\; \backslash frac\{1\}\{3\}\backslash right)$ black bulls + yellow bulls,
 Black bulls $=\backslash left(\backslash frac\{1\}\{4\}\; +\; \backslash frac\{1\}\{5\}\backslash right)$ dappled bulls + yellow bulls,
 Dappled bulls $=\backslash left(\backslash frac\{1\}\{6\}\; +\; \backslash frac\{1\}\{7\}\backslash right)$ white bulls + yellow bulls,
 White cows $=\backslash left(\backslash frac\{1\}\{3\}\; +\; \backslash frac\{1\}\{4\}\backslash right)$ black herd,
 Black cows $=\backslash left(\backslash frac\{1\}\{4\}\; +\; \backslash frac\{1\}\{5\}\backslash right)$ dappled herd,
 Dappled cows $=\backslash left(\backslash frac\{1\}\{5\}\; +\; \backslash frac\{1\}\{6\}\backslash right)$ yellow herd,
 Yellow cows $=\backslash left(\backslash frac\{1\}\{6\}\; +\; \backslash frac\{1\}\{7\}\backslash right)$ white herd.
If thou hast computed these also, O friend, and found the total number of cattle, then exult as a conqueror, for thou hast proved thyself most skilled in numbers.^{[2]}
 White bulls + black bulls = a square number,
 Dappled bulls + yellow bulls = a triangular number.
The first part of the problem can be solved readily by setting up a system of equations. If the number of white, black, dappled, and yellow bulls are written as $W,\; B,\; D,$ and $Y$, and the number of white, black, dappled, and yellow cows are written as $w,b,d,$ and $y$, the problem is simply to find a solution to:
W &{}=\frac{5}{6}B+Y \\ B &{}=\frac{9}{20}D+Y \\ D &{}=\frac{13}{42}W+Y \\ w &{}=\frac{7}{12}(B+b) \\ b &{}=\frac{9}{20}(D+d) \\ d &{}=\frac{11}{30}(Y+y) \\ y &{}=\frac{13}{42}(W+w) \end{align}
which is a system of seven equations with eight unknowns. It is indeterminate, and has infinitely many solutions. The least positive integers satisfying the seven equations are:
B &{}=7,460,514k \\ W &{}=10,366,482k \\ D &{}=7,358,060k \\ Y &{}=4,149,387k \\ b &{}=4,893,246k \\ w &{}=7,206,360k \\ d &{}=3,515,820k \\ y &{}=5,439,213k \end{align}
which is a total of 50,389,082k cattle^{[2]} and the other solutions are integral k multiples of these. Note that the first four numbers are multiples of 4657, a value which will appear repeatedly below.
The general solution to the second part of the problem was first found by A. Amthor^{[3]} in 1880. The following version of it was described by H. W. Lenstra ^{[4]}, based on Pell's equation: the solution given above for the first part of the problem should be multiplied by
where
and j is any positive integer. Equivalently, squaring w results in,
where {u,v} are the fundamental solutions of the Pell equation,
The size of the smallest herd that could satisfy both the first and second parts of the problem is then given by j = 1, and is about $7.76\; \backslash times\; 10^\{206544\}$ (first solved by Amthor). Modern computers can easily print out all digits of the answer. This was first done at the University of Waterloo, in 1965 by H. C. Williams, R. A. German, and C. R. Zarnke. They used a combination of the IBM 7040 and IBM 1620 computers.
The constraints of the second part of the problem are straightforward and the actual Pell equation that needs to be solved can easily be given. First, it asks that B+W should be a square, or using the values given above,
thus one should set k = (3)(11)(29)(4657)q^{2} for some integer q. That solves the first condition. For the second, it requires that D+Y should be a triangular number,
Solving for t,
Substituting the value of D+Y and k and finding a value of q^{2} such that the discriminant of this quadratic is a perfect square p^{2} entails solving the Pell equation,
Amthor's approach discussed in the previous section was essentially to find the smallest v such that it is integrally divisible by 2*4657. The fundamental solution of this equation has more than 100,000 digits but can be solved by online software such as Dario Alpern's "Quadratic TwoVariable Equation Solver" in about 50 seconds.
