Crossy Posted January 7, 2009 Share Posted January 7, 2009 (edited) A collegue arrived at the office this morning puzzling over his sons maths homework, the son is 10. The question Chocolate bars cost 26p Fruit bars cost 18p How many of each can I buy for EXACTLY 5 pounds (500p)? [whole bars only obviously] It's easy enough to brute-force an answer, particularly if you use Excel to do the sums but is there an elegant bit of algebra that will yield the same results? It's been WAY too long since either of us did maths homework EDIT I know the answer(s) by brute force, it's a more elegant method I'm looking for 'please show all working' Edited January 7, 2009 by Crossy Link to comment Share on other sites More sharing options...
mr_hippo Posted January 7, 2009 Share Posted January 7, 2009 (edited) Sorry, misread '26' for '25'! Edited January 7, 2009 by mr_hippo Link to comment Share on other sites More sharing options...
Jimmyd Posted January 7, 2009 Share Posted January 7, 2009 (edited) I think there will always be a certain amount of brute force in this one. One thing you can do is simplify the problem a bit: 26X + 18Y = 500 has the same solutions as 13X + 9 Y = 250 (by dividing both sides by 2). Starting with the biggest possible value of x: 13*19 + 3 = 250 work your way down to 13*13 + 81 = 250, which is the first solution as we have 13*13 + 9*9 = 250. From here, every ninth one will be a solution, so 13*4 + 198 = 250 or 13*4 + 9*22 = 250 is a solution. Therefore, the two possible solutions are: 1) 13 of the 26 pence bars and 9 of the 18 pence bars 2) 4 of the 26 pence bars and 22 of the 18 pence bars There may be a more elegant way to solve the problem using number theory, but it would be, I suspect and as the professors often say, "beyond the scope" of your kid's class. Edited January 7, 2009 by Jimmyd Link to comment Share on other sites More sharing options...
Jimmyd Posted January 7, 2009 Share Posted January 7, 2009 Another way to do it came to mind--this one is even a bit easier. After reducing the problem to 13X + 9Y = 250, all you need to do is to subtract 13 from 250 until you get a multiple of 9. This is easy to spot, because if all the digits of a number sum to a multiple of 9, then the number itself is a multiple of 9 and if they do not, the number is not a multiple of 9. Hence 111,333,222 is a multiple of 9 since 1+1+1+3+3+3+2+2+2 = 18 which is 2 times 9. So: 250 (2+5+0=7) 237 (2+3+7=12) 224 (2+2+4=8) 211 (2+1+1=4) 198 (1+9+8=18=2*9 Bingo!) And in this case, the thirteenth one below it will also work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now