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 milk-white, 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:
White bulls \$= (\frac{1}{2} + \frac{1}{3})\$ black bulls + yellow bulls,
Black bulls \$= (\frac{1}{4} + \frac{1}{5})\$ dappled bulls + yellow bulls,
Dappled bulls \$= (\frac{1}{6} + \frac{1}{7})\$ white bulls + yellow bulls,
White cows \$= (\frac{1}{3} + \frac{1}{4})\$ black herd,
Black cows \$= (\frac{1}{4} + \frac{1}{5})\$ dappled herd,
Dappled cows \$= (\frac{1}{5} + \frac{1}{6})\$ yellow herd,
Yellow cows \$= (\frac{1}{6} + \frac{1}{7})\$ white herd.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 = a square number,
Dappled bulls + yellow bulls = a triangular number.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.
- Archimedes
Some clarifications:
- black herd = black bulls + black cows, white herd = white bulls + white cows, etc.
- \$(\frac{1}{2} + \frac{1}{3})\$ black bulls + yellow bulls, means only the black bulls get the coefficient
- A square number is a number which can be represented as
n * n
where n is an integer - A triangular number is a number which can be represented as
1 + 2 + ... + (n - 1) + n
Task
Write a program/function to output the size of the smallest herd that could satisfy both the first and second parts of the above problem.
Output
You must output this number. Standard Output rules for integers apply.
Scoring
This is code-golf so shortest bytes wins.
Hash of decimal representation of answer for easy checking:
- sha256 (with newline):
4fce7274734a18e9d27592e59480b50876da243de4caef4323f783339c456a7c
- sha256 (without newline):
8500b362f3d6b5e96c775ca16d1475b519ff18669b0f6f3d35e4fb23d2c18d01
Inspired by The Archimedes Number - Numberphile
black bulls + yellow bulls
, meaning only the black bulls get the coefficient? \$\endgroup\$