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 :\begin{align} 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 :\begin{align} B &= 7\,460\,514 = 4657 \times 1602,\\ W &= 10\,366\,482 = 4657 \times 2226,\\ D &= 7\,358\,060 = 4657 \times 1580,\\ Y &= 4\,149\,387 = 4657 \times 891,\\ b &= 4\,893\,246, \\ w &= 7\,206\,360, \\ d &= 3\,515\,820, \\ y &= 5\,439\,213, \end{align} which is a total of cattle, and the other solutions are integral multiples of these. Note that given the
prime number p = 4657 then the first four numbers are multiples of
p, and both
p and
p + 1 will appear repeatedly below. The second part of the problem states that W+B is a
square number, and Y+D is a
triangular number. The general solution to this part of the problem was first found by A. Amthor ==Pell equation==