I have been enjoying reading Keith Devlin’s new book, Finding Fibonacci. I’ll write more about the book later. For now, I just wanted to share a nice problem I learned about which Leonardo Pisano, aka Fibonacci, included in his book Liber abbaci. First published in 1202, this is the book that introduced the Hindu-Arabic number system to the Western world. Apparently this problem is well-known among mathematicians, but I had never heard it. Here it is, as translated from Latin by Laurence Sigler:
A certain man buys 30 birds which are partridges, pidgeons, and sparrows, for 30 denari. A partridge he buys for 3 denari, a pigeon for 2 denari, and 2 sparrows for 1 denaro, namely 1 sparrow for 1/2 denaro. It is sought how many birds he buys of each kind.
Can you solve it?
3 partridges, 5 pigeons, 22 sparrows. Not a trick question.
It is a system of linear equations with natural coefficients. After a simple substitution we get to an equation 3x + 5y = 30. Since 3 and 5 are mutually prime, there is a unique solution: x = 3, y = 5.
P = no. of partridges, I = # of pigeons, S=sparrows;
quantity statment: P + I + S = 30 or S = 30 – P – I;
value statement 3P + 2I + 0.5S = 30 or 6P + 4I + S = 60 Substitute for S
6P + 4I + 30 – P – I = 60 leaves 5P + 3I = 30; birds must be natural numbers so (P,I) = (3,5)
Checking 3 partridge, 5 pigeons & 22 sparrows –> 3(3) + 5(2) + 22(0.5) = 9 + 10 + 11 = 30
You could also have 6 partridges and 24 sparrows, or 10 pigeons and 20 sparrows, depending on how you interpret “30 birds which are partridges, pidgeons, and sparrows”…
3x+5y=30 has a second solution with non-negative integer values: x=0,y=6. Does the man have to end up with at least one of each kind of bird, or can he have zero pigeons? 6 partridges, 0 pigeons, and 24 sparrows also satisfies the equalities: (6+0+24)=30, and 6(3)+0(2)+24(0.5)=30.
Good observations! I think the idea is that from “…buys some birds which are partridges, pidgeons, and sparrows…” we are supposed to infer that he buys a positive number of each.
Assume that there is at least one partridge, pigeon and sparrow.
Let x= partridge(s), y= pigeon(s) and z= sparrow(s):
we know that: 1) x + y + z = 30
2) 3*x + 2*y + .5*z = 30
3) 0 < z < 28 (to allow room for at least one x and y)
4) 0 < x < 10 (to allow room for at least one y and z)
5) 0 < y < 15 (to allow room for at least one x and z)
6) z must be a multiple of 2 (to result in a whole number)
We can:
for each value of z from 2 to 28
for each value of y from 1 to 15
for each value of x from 1 to 10
test if x+y+z = 30. If so call it a contender.
test each contender to see if 3*x + 2*y + .5*z = 30, If so call it a solution.
This results in 63 contenders and one solution: x=3, y=5, z=22
It's about 30 lines of Python–though the search space is small enough that you can find it by hand.
These work, but are dissatisfying (like fast food). There is enough information that I think there should be a direct (i.e. mathematical solution), but it eludes me. Sigh.