 # Unsolvable math logic problem?

While solving math logic problems I came across this:

So:

Price of a pear = x
Price of a peach = x+0.05X, or 1.05x

Quantity of pears = A
Quantity of peaches = B

Ax+1.05Bx=7.99
It seems that there is not enough information provided to solve the problem. I must solve for three variables in one eqation, which seems impossible given no other equation. (Quantities are not given in the problem).

Am I missing something; or is this truly unsolvable.
(I know the answer as I ultimately looked it up in the back of the book; but I still can’t find a way to solve the problem).

You also know that the price x is likely a positive integer, and that the number of pears and peachers A,B are probably positive integers. It makes sense that with a five percent difference, x is probably a multiple of 20 (1.05x=21).
To end in a nine, this might require nine (or multiple of nine) peaches, since if the price of a pear is a multiple of 20, several pears will have a price ending in zero.

So start figuring things with these assumptions.

Nine peaches might cost \$1.89, leaving \$6.10 – which works if you allow 30.5 pears (violating an original assumption).

18 peaches and 61 pears would also work, if you assume the price x is NOT an integer, i.e. 10.5 cents a peach.

When you have more variables than equations, the potential exists for an infinite number of solutions. This would be winnowed by demanding positive integers for price and numbers.

If each peach cost 63 cents, 3 would cost \$1.89 (leaving \$6.10 again), 13 would cost \$6.30+\$1.89 or more than \$7.99

If each peach cost \$.21*9=\$1.89, each pear is \$1.80 – not an even multiple of \$6.10

It being late, I’m going with my first two answers.

That’s the thing, I thought problems like these are supposed to be solved on the merit of logic, not assumptions or trial and error. I could have solved it had I tediously tried various quantities and prices of pears and peaches; but then why call it a logic problem? Why not just ask “what am I thinking of?” and I’ll guess until I’m correct?

x and 1.05x have to be positive integers. Therefore, as Dr.Paprika notes, x has to be a multiple of twenty. I believe, though I’m not certain (It’s late), that anything that works for 20n will work for just plain 20, but obviously not vice versa. So let pears be 20 cents and peaches be 21 cents. Then it’s just a matter of finding 799-20n such that 799-20n is divisible by 21. 399/21=19. So 19 peaches at 21 cents and 20 pears at 20 cents will do it. In fact it’s the only possible solution, since if the prices were higher–40 and 42, say–you wouldn’t have an integral number of peaches, as 19 is prime.

I realize this is pretty inelegant. If anyone has a better solution I’m all ears.

You also know (using your notation) that A and B are positive integers and that whatever value x (the price of the pear) is, adding 5% to it must produce an exact value in dolars in cents, e.g. x can’t be 62 cents, since 5% of 62 is 3.1 cents, a non-integer value.

Thus, x must be a multiple of .20 (the smallest value x where 5% of x is an integral number of cents). Set x = .20y, where y is an integer. Using your equation:

A(.20y) + 1.05B(.20y) = 7.99

(A + 1.05B)y = 39.95

Multiply thru by 100 and divide by y:

100A + 105B = 3995/y

Thus, y must be a factor of 3995 = 51749. Thus, the only values allowed for y are 1, 5, 17, 49, 85, 245, 799, or 3995. Since x must be less than 7.99 => y< 39.95, y is limited only to the first three values 1, 5, and 17.

y=17 leads to prices of 3.40 and 3.57 for the two fruits. You’d have to by at least 7 peaches to get a total that ends in 9, and that’s going to be higher than 7.99, so this value is out. y=5 leads to prices of 1.00 and 1.05,m and no combination of these leads to a price that ends in 9, so that value is out as well.

Consequentially, y=1 => x=.20. The pears must cost .20 and the peaches .21, so to get a total that ends in 9 you had to have sold 9, 19, or 29 peaches (If you sell more than 38 peaches, you collect more than \$7.99)

Selling 9 peaches nets you 1.89, meaning you had to sell 6.10 worth of pears. But this is impossible, since pears sell for .20 each. Ditto 29 peaches, which would net 6.09, and you can’t sell 1.90 worth of pears if they sell for .20 each. Thus, you must have sold 19 peaches, collecting 3.99, and sold 20 pears to cover the other \$4.

Pears = sold 20 @ .20 each
Peaches = sold 19 @ .21 each

It’s not pure trial and error. The key is realizing that if the cost of so many pears ends in zero, the peaches alone have a price ending in nine cents. Nine can only be factored as 33, 19 or 9*1. This greatly limits the number of choices, in fact I think I covered most of them, though I stopped before getting the integral answer.

Very nice CJJ*, except for a typo: 3995 = 5 × 17 × 47

A puzzle like this, where the unknown variables must be positive integers, is called a Diophantine equation. And the fact that they must be positive integers is often assumed, even though in real life there’s no reason why a grocery store can’t sell a fraction of a piece of fruit (they do it with large pieces of fruit, like melons, so why can’t they sell a quarter of a peach?), and there’s no reason why they can’t price things in fractions of a cent (they do it with gallons of petrol, selling at something like \$2.899 per gallon, so why can’t they sell peaches at 2.1 cents each?). If you allow fractions, then trivially the problem has many more solutions (e.g., double the price, and sell the fruit in halves, or halve the price and sell twice as much fruit).

I might add that, of course, there is one case where shops do sell fruit and similar things priced in fractions of a cent: when they do something like “3 apples for \$1”. (And the cash register is programmed to change you 34 cents for the first apple, then 33 cents each for the next two).

Oops, such is the danger of posting late at night.

I should also point out that the factoring is really unnecessary. If the pears and peaches can be sold for some multiple of .20 and .21 (say, .80 and .84) and these prices produce a combination that totals 7.99, there must also be a combination that works when you price them at .20 and .21 (for the example, it would be 4 times the number sold at .80 and .84).

We can now invoke a rule beloved by logic puzzlers and algebra students, the Law of There’s-Only-One-Right-Answer. If there is a solution when, say, pears sold for .80 and peaches .84, there’d have to be a solution for when the prices were .20 and .21 (and, for that matter, also when the prices were .40 and .42). Since the parameters of the problem offer no way to choose one the two (or three) solutions, we can discard any possibility that the prices are a multiple of the base .20 and .21 prices (since then we’d have more than one correct answer). Therefore we can safely conclude x=.20.

Oops, such is the danger of posting late at night.

I should also point out that the factoring is really unnecessary. If the pears and peaches can be sold for some multiple of .20 and .21 (say, .80 and .84; don’t bother looking for an answer–there isn’t one–I’m making a hypothetical point) and these prices produce a combination that totals 7.99, there must also be a combination that works when you price them at .20 and .21 (for the example, it would be 4 times the number sold at .80 and .84).

We can now invoke a rule beloved by logic puzzlers and algebra students, the Law of There’s-Only-One-Right-Answer. If there is a solution when, say, pears sold for .80 and peaches .84, there’d have to be a solution for when the prices were .20 and .21 (and, for that matter, also when the prices were .40 and .42). Since the parameters of the problem offer no way to choose one the two (or three) solutions, we can discard any possibility that the prices are a multiple of the base .20 and .21 prices (since then we’d have more than one correct answer). Therefore we can safely conclude x=.20.

Your forgetting that that 9 in not the only number ending in 9. E.g. 39 = 3x13, 49 = 7x7

A basic fact in Diophantine Equations is given Ax+By=C then gcf(A, B) must divide C.

As shown by others, the equation can be rewritten to: 20Nx + 21Ny = 799
Now 20 and 21 are relatively prime so that means that N must divide 799
799 = 17 x 47 so N is 1, 17, or 47 (down to 3 possibilities)
N=1 => 20x + 21y= 799 => x=20, y=19 (since 19 is prime we are done as you will see below)
N=17 => 340x + 357y = 799 => 20(17x) + 21(17y) = 799. Since we know 17x=20 and 17y=19 from above, we can conclude x=20/17 and y=19/17
N=47 => same logic we get x=20/47 and y=19/47

So now that we know the equation is 20x + 21y= 799, what are all the solutions?
Given one solution (x,y), all other solutions are of the form x+(21/1)m and y-(20/1)m. The 21 and 20 are simply A and B reversed and 1=gcf(20,21). m is an arbitrary integer and it is not too difficult to show that the only integer that give 2 positive answers is 0. As an example, m=-1 give x=-1, y=39 or m=1 give x=41, y=-1.

Therefor the solution (given the parameters of the problem) is unique and is 20 pears at \$0.20 each and 19 peaches at \$0.21 each.

Of course you’re right, SaintCad. I was just trying to make the point that the number of numbers is limited – I wasn’t really trying to be exhaustive, or even to do someone else’s homework and “give away” the answer. I am too lazy to get into (10y+3)*3, (10y+7)*7, etc. Guess my days of mathematical rigour are behind me. There’s also a difference between an infinite number of solutions and an unsolvable problem, of course. I went to one of my math finals, either diff. eq or abstract algebra, and there was a problem on the board. It involved a farmer selling or buying sheep and cows, and then with the change he bought a pig. No initial amount of money, nor number of livestock involved were mentioned. It did not contain enough information for the number of variables in it to solve it as a traditional algebra problem, and the course we were taking the final for did not prepare us for that problem. We sat stunned for a bit, one guy worked out the answer was the pig cost six dollars, because nothing else worked but we had no way to say why it was six. I felt like I was going to vomit and the rest of the class looked a bit shell shocked when the teacher came in and to our great relief erased the problem.

A semester later, in number theory, I not only understood how to get the answer, which was indeed 6 dollars for the pig, by proper methods, but also could reconstruct what the problem was it based on a vague memory and knowlege of the answer. I need to brush up on number theory, it was fun.