View previous topic :: View next topic |
Author |
Message |
| pooby
| Joined: 21 Jun 2005 | Posts: 2 | : | | Items |
|
Posted: Tue Jun 21, 2005 9:52 am Post subject: Urgent : Number Possibility puzzle |
|
|
Hi all,
I have a little flash game, which is Mathematical calculations oriented. I'm neither a Mathematics guy nor a Statistics guy.
The concept of the game is:
We have 3 input values: 1) Possibilities 2) Objective (output value) 3) Max. no. of clicks (max. number of combination numbers Ex. if 4, then 1 + 2 + 3 + 4)
Lets take this Values for example :
Objective = 109
Clicks =5
Possibilities = 600
(There can be n number of objectives, n number of clicks and n number of possibilities)
The main objective of the game is to find the number of possible combinations which can meet the objective.
From the above example with a max. of 5 numbers we have to produce a output of 109, with a maximum of 600 possibilities or
all possibilities that match the objective.
ex: 99+ 1+2+3+4 = 109. Like this we have to show 600 possibilities which should give a total of 109 using five values.
1) The same values can not be repeated again.
Ex: 1+1+5+6
2) All the values in a possibilitiy should not repeat again in any of he possibilities in any form.
Ex: 1 + 2 + 3 and
2 + 3+ 1 and
3 + 2 + 1 should not be shown. Only one of these three should be shown.
3) Negative and Zero's are not allowed.
To Calculate the possibilities , I need a simple algorithm/logic which could make the calculation process simple.
The system has to find as many possibilities with these parameters to print in a final report.
Any suggestions/algorithm which can be used to find a solution will be highly appreciated. |
|
Back to top |
|
|
| Doug
| Joined: 28 May 2005 | Posts: 42 | : | | Items |
|
Posted: Tue Jun 21, 2005 10:48 am Post subject: |
|
|
This has little to do with Sudoku. This is a Sudoku programming forum.
I would suggest doing a web search on "The Theory of Partitions", or "Integer Partitions", or "Partitions of Integers" as your problem, whatever it is, falls in that area of number theory. The way you state things is very ambiguous anyway.
Good luck. _________________ Doug Bowman
www.flickr.com/photos/bistrosavage |
|
Back to top |
|
|
| Simes
| Joined: 08 Apr 2005 | Posts: 71 | : | Location: North Yorkshire, UK | Items |
|
Posted: Tue Jun 21, 2005 8:06 pm Post subject: |
|
|
Is it just me, or does this sound like a homework question?
But anyway, how appreciative will you be, renumeration-wise?
S _________________ Simes
www.sadmansoftware.com/sudoku |
|
Back to top |
|
|
| Simes
| Joined: 08 Apr 2005 | Posts: 71 | : | Location: North Yorkshire, UK | Items |
|
Posted: Tue Jun 21, 2005 8:30 pm Post subject: |
|
|
Quote: | The main objective of the game is to find the number of possible combinations which can meet the objective. |
Is it intended to be fun or "educational"? it must be a pretty odd game, as a quick program gives 36756 possible ways for exactly 5 different non-zero positive integers to add up to 109. (Let me know if you want the list )
If you allow for a "max of 5" numbers, then this total will obviously be much bigger.
How are you supposed to work that out in a game? _________________ Simes
www.sadmansoftware.com/sudoku |
|
Back to top |
|
|
| Doug
| Joined: 28 May 2005 | Posts: 42 | : | | Items |
|
Posted: Tue Jun 21, 2005 11:53 pm Post subject: |
|
|
Actually, there are published formulas for this, recurrences as well as exact formulas. The problem you describe, simes (not sure if what you posted is exactly what the original poster intended), is finding the number of partitions of 109 into 5 distinct summands. The basic reference for this area of mathematics is: "The Theory of Partitions by George E. Andrews. Cambridge University Press, 1984. BTW Euler is credited with inventing the theory of partitions. Yes, the same Euler who worked with latin squares!
Formulas for the number of partitions of n into j distinct parts were published by J.W.L. Glaisher in 1908: "Quart. J. Pure and Appl. Math.", vol 40 (1908/09), pp. 57-143. These have been rediscovered many times since.
And yes, you are correct about the homework thing. It is exactly the sort of problem I give as an excercise in a class on enumerative combinatorics! (Something I teach from time to time.) _________________ Doug Bowman
www.flickr.com/photos/bistrosavage |
|
Back to top |
|
|
| Simes
| Joined: 08 Apr 2005 | Posts: 71 | : | Location: North Yorkshire, UK | Items |
|
Posted: Wed Jun 22, 2005 5:16 am Post subject: |
|
|
Quote: | ...(not sure if what you posted is exactly what the original poster intended)... |
Quite possibly, but the requirement spec is a little confusing. _________________ Simes
www.sadmansoftware.com/sudoku |
|
Back to top |
|
|
| pooby
| Joined: 21 Jun 2005 | Posts: 2 | : | | Items |
|
Posted: Wed Jun 22, 2005 5:37 am Post subject: |
|
|
Hi experts,
Thanks for your comments/suggestions. I really believe that you guys solved many hard problems. As I'm not good in these logics, I highly appreciate if someone can help me out in this issue.
Some say that my query is little confusing. Let me explain it again.
when a numeric value is given to a) number of clicks b) objective c) Possibility, the code should find the number of possibilities which can give the objective using the number of clicks. All the three input values are not static. User can input any values.
Ex: number of clicks = 5
Objective (output value) = 109
No. of possibilities to be shown = 3000.
Even if the code could not find 3000 possibilities, it should display the available possibilities which should be equal to 109 using the sum of 5 numbers.
But while displaying the possibilities there are some restrictions:
1) Same number cannot be repeated in a possibility.
ex. 102 + 1+1+2 +3
2) Same possibility should not occur in any form in the list.
ex. 96 + 1 +3 +2 + 7 and
1 + 2 + 3 + 7 + 96
3) Negative and Zero's are not allowed.
I'm sorry if my query again makes you feel confusing.
- Pooby |
|
Back to top |
|
|
|