Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 Re: Help Me ! » What kind of mathematical problem is this?? » 2006-07-07 02:00:24

Do you mean to say that the coins can have any value, and this was an example of such values, or that the coins must have these values?

No, the coins are of defined value. Only 5, 7, 10, 15, 25 and 50 USD coins exist. Only those values can be used. But there is no limit to the number of coins of each value I may use.

Just clarifying to begin with. Can you choose the coin values (5,7,10, etc) or are they given? For example binary powers (1,2,4,8,16,32,..) would help. And the "71", is that going to change each time?

The values are given. Only those coins are available. But as stated above, I can use for example as many 5 USD coins as I should need in the optimal solution...
The "71" will change every time. Could be any other figure, but of course, will be limited somehow otherwise the algorithm would calculate eternally tongue. For example, the maximum would be around 300 USD


Just an example: 285 USD would result in 11*25 and 1*10 (so, the total is 285, and I have exactly 12 coins)...

#2 Help Me ! » What kind of mathematical problem is this?? » 2006-07-07 00:26:23

Estelle001
Replies: 17

Hi there!

I have a problem.... (yes, a dream to wink  ). I need to solve a quite difficult mathematical problem (to me anyhow). I've been browsing the web for quite some hours now and still am puzzeled how to solve this problem in a program (would like to create a php program for this) or to find the mathematical solution. I've read about the knapsack problem, but I'm not sure I'm on the right track as my problem has no "weight" (I think... :s)

So, this is my challenge:
I have an unlimited number of coins, let's hypothetically say with value 5, 7, 10, 15, 25 and 50 (let's suppose this would exist in USD).
I want to fill my purse with a number of coins and the total value should be for example 71 USD with that restriction that I want 12 coins in my purse or a number of coins as close to 12. If 71 can not be composed with 12 coins, I need to find the combination of coins as close to 71 (but not higher !) with a number of coins as close to 12 (slightly below or slightly above).

Hm, even formulating the problem is not easy. I hope you understand the problem. Is this a knapsack problem??? Or should I look in another direction? Can s.o. give me a clue how to solve this? Even better.. If anyone would know a php program (or java or so) for it, that would be GREAT!? or the formula...

Maybe this problem is easier to you than to me (hope so).
thans to all !
Estelle.

Board footer

Powered by FluxBB