NPR Sunday Puzzle (Jun 29): Anyone have a Pencil?:
Q: A man buys 20 pencils for 20 cents and gets three kinds of pencils in return. Some of the pencils cost 4 cents each, some are two for a penny and the rest are four for a penny. How many pencils of each type does the man get?
It's a rare NPR *math* puzzle. Using algebra you could write an equation for the number of pencils, and one for the cost of the pencils. But that results in two equations and three unknowns. Fortunately there are some constraints and a little trial and error will get you the answer. Note: You have to have at least one of each type, so just getting 4 of the first type and 16 of the last type wouldn't work.
Edit: I think the thing that confused most people was they assumed they had to buy 4 of the 1/4 cent pencils, or 2 of the 1/2 cent pencils. You can't make 20 cents with those constraints. Here's how I solved it.
Let A be the number of 4 cent pencils.
Let B be the number of 1/2 cent pencils.
Let C be the number of 1/4 cent pencils.
Number of pencils:
A + B + C = 20 pencils
Cost of pencils:
4A + B/2 + C/4 = 20 cents
Multiplying this second equation by 4 to remove the fractions we have:
16A + 2B + C = 80
Now subtract the first equation to eliminate one variable:
15A + B = 60
There are some obvious constraints on A. Because you need at least one of each type of pencil, none of the values can be 0. That eliminates A = 0 or A = 4. Trying the other values you get:
A = 1, B = 45 --> too many pencils
A = 2, B = 30 --> too many pencils
A = 3, B = 15 --> C = 2
A:
3 pencils (at 4 cents) = 12 cents
15 pencils (at 1/2 cent) = 7 1/2 cents
2 pencils (at 1/4 cent) = 1/2 cent