Mathematics desk | ||
---|---|---|
< September 16 | << Aug | September | Oct >> | Current desk > |
Welcome to the Wikipedia Mathematics Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
2-Euro coins weigh 8.5 gram. 1-Euro coins weigh 7.5 gram. How many of each would you need to have exactly 1 kg?
I solved the problem by trial and error, limiting the max nr. of coins to 1000/8.5=117. The results are: 10, 25, 40, 55, 70, 85, 100, 115x 2-Euro coins and the 1-Euro complement.
for i in range(1,117): .... if (1000 - 8.5*i) % 7.5 == 0: .... print(f'{i}x 2 Euro coins and {int((1000-i*8.5)/7.5)}x 1 Euro coins.')
Is there a more direct way of solving this and similar kinds of problems? -- Bumptump ( talk) 23:28, 17 September 2021 (UTC)
Mathematics desk | ||
---|---|---|
< September 16 | << Aug | September | Oct >> | Current desk > |
Welcome to the Wikipedia Mathematics Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
2-Euro coins weigh 8.5 gram. 1-Euro coins weigh 7.5 gram. How many of each would you need to have exactly 1 kg?
I solved the problem by trial and error, limiting the max nr. of coins to 1000/8.5=117. The results are: 10, 25, 40, 55, 70, 85, 100, 115x 2-Euro coins and the 1-Euro complement.
for i in range(1,117): .... if (1000 - 8.5*i) % 7.5 == 0: .... print(f'{i}x 2 Euro coins and {int((1000-i*8.5)/7.5)}x 1 Euro coins.')
Is there a more direct way of solving this and similar kinds of problems? -- Bumptump ( talk) 23:28, 17 September 2021 (UTC)