Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsDiscussion Forum → Need help from the mathematically-inclined
Need help from the mathematically-inclined
2004-01-06, 6:15 AM #1
Alright, this shouldn't be terribly hard, but I am mathematically challanged, so any help you can give would be much appreciated:

Given a table with a total of 18 numbered variables like such:
Code:
     |     X    |     Y    |     Z    |
---------------------------------------
  a  |     1    |     2    |     3    |
---------------------------------------
  b  |     4    |     5    |     6    |
---------------------------------------
  c  |     7    |     8    |     9    |
---------------------------------------
  d  |    10    |    11    |    12    |
---------------------------------------
  e  |    13    |    14    |    15    |
---------------------------------------
  f  |    16    |    17    |    18    |
=======================================


Given also that each numbered variable can have a value between 1 and 10 (nothing below 1, and nothing above 10).

The sum of all the valued variables must equal 90.

I wish to know how many possible combinations can be obtained given the above.

Thanks for any help you can give [http://forums.massassi.net/html/smile.gif]

------------------
Check out the following stories over at the Interactive Story Board:
The Never-ending Story Thread or visit the new webcomic version!
The Vision Cycle series
Featured Story: Dead

[This message has been edited by Gebohq (edited January 06, 2004).]
The Plothole: a home for amateur, inclusive, collaborative stories
http://forums.theplothole.net
2004-01-06, 8:36 AM #2
Do you mean how many combinations can be achieved that equal 90?

I calculated 357,0467,226,624 combinations if they can equal any value between 1 and 10 and don't have to add up to 90.

------------------
I munch C code for breakfast and have enough room left over for a kernel debugging.
Free your mind, use Open Source.
2004-01-06, 11:54 AM #3
Yes, that equal 90.

I wonder if half the number given in the last post would be it...
The Plothole: a home for amateur, inclusive, collaborative stories
http://forums.theplothole.net
2004-01-06, 11:58 AM #4
For these combonations, can you have multiple of the same combo, only using different variables?

What I mean:

Say you had a combo where variable6 was 8 and variable7 was 2. If you had another combonation where all other variables were the same except variable6 was now 2 and variable7 was now 8, would that count as another combo?
2004-01-06, 3:50 PM #5
Yes.
The Plothole: a home for amateur, inclusive, collaborative stories
http://forums.theplothole.net
2004-01-06, 3:56 PM #6
I would say half of Freyr's result.
Detty. Professional Expert.
Flickr Twitter
2004-01-06, 5:19 PM #7
I'm thinking perhaps it's not necessarily half...

And whomever obtains an answer, could they show what equation they used to get it? JUst so it can be double-checked by others and whatnot. Thanks.
The Plothole: a home for amateur, inclusive, collaborative stories
http://forums.theplothole.net
2004-01-07, 8:54 AM #8
Well, for a single variable there are x^1 number of combinations. Where x is the the range (1 - 10). So one number has 1^10 = 10 number of solutions. So if there are 2 then the number is x^2. So if there is no value they have to equal it is 10^16 = 10,000,000,000,000,000 combinations. Well if they have to equal 90 then your need at least 9 values of 10 to even start to equal 90 with out any other numbers. So here it goes.

10,10,10,10,10,10,10,10,3,1,1,1,1,1,1,1,1

So for just one string there can be 16! combinations by arranging the numbers differently. 20,922,789,888,000 combinations.

So I think 20,922,789,888,000 * 16 Is the total number of solutions. Which equals 334,764,638,208,000. (phew!)

Someone please tell me If I'm wrong.

------------------
I munch C code for breakfast and have enough room left over for a kernel debugging.
Free your mind, use Open Source.
2004-01-07, 10:32 AM #9
Did that help?

------------------
I munch C code for breakfast and have enough room left over for a kernel debugging.
Free your mind, use Open Source.
2004-01-07, 11:18 AM #10
Just to clarify: There are 18 variables between 1-10 that need to all add up to 90. You're looking for the number of possible combinations. Right?

If so, this should do it:
Code:
#include <stdio.h>
#include <iostream.h>

int main() {
  int total=0;
  int count=0;
  int array[18]={9,10,10,10,10,10,10,10,1,1,1,1,1,1,1,1,1,1};
  
  while (array[17]<=10) {
    array[0]=array[0]+1;
    for (int x=0; x<18; x++) {
      if (array[x]>10) {
        array[x]=1;
        array[x+1]=array[x+1]++;
      }
    } 
    for (int x=0; x<18; x++) {
      total=total+array[x];
      //cout << array[x] << "  ";
    }
    if (total==90) {count++;}
    total=0;
    
    cout << count << " ";
  }
  cout << endl << endl << "the final count is: " << count;
  system("pause");
}
Note that I don't really know C++. Somebody should probably check it. It's also horribly inelegant.

int array[18]={9,10,10,10,10,10,10,10,1,1,1,1,1,1,1,1,1,1} is there to save time: it's just before the first valid result.
2004-01-07, 1:28 PM #11
Well, my program has found nine combinations so far. Unfortunately, it'll take about 30,000 years at a million checks per second to actually finish all 10^18 possible arrangements. I've had a couple thoughts, though.

First, the distribution of the sum of 18 numbers between 1 and 10 is a bell curve: only one combination makes 18 and 180, eighteen combinations make 19 and 179, over 300 combinations make 20 and 178, etc.

Second, finding all the unique combinations and then shuffling them wouldn't take as long.
2004-01-08, 12:55 PM #12
Quote:
<font face="Verdana, Arial" size="2">it'll take about 30,000 years at a million checks per second to actually finish all 10^18 possible arrangements</font>


That always stinks [http://forums.massassi.net/html/frown.gif], I counted 3,168,876 years to complete that task.

------------------
I munch C code for breakfast and have enough room left over for a kernel debugging.
Free your mind, use Open Source.
2004-01-09, 5:16 AM #13
Yeah, it was 18, not 16. Otherwise, thanks! I can't tell you if you're wrong or not, obviously -- posting how you did it was for others to say whether you got it right or not.

Thanks for all the input thus far!

------------------
Check out the following stories over at the Interactive Story Board:
The Never-ending Story Thread or visit the new webcomic version!
The Vision Cycle series
Featured Story: Dead
The Plothole: a home for amateur, inclusive, collaborative stories
http://forums.theplothole.net

↑ Up to the top!