Hi,
I want to generate all possible combination of 7 numbers (non-repetitive) out of 189 (1 to 189) and all seven number total must be 161.
Any help?
Hi,
I want to generate all possible combination of 7 numbers (non-repetitive) out of 189 (1 to 189) and all seven number total must be 161.
Any help?
Hi.
Do you realise that the number of different combinations of 7 numbers from 189 is more than one-and-a-half trillion, i.e.:
1,527,510,868,092
which would require 1,456,748 columns to be fully populated in a standard Excel 2010 sheet, which would need 89 worksheets with every single cell fully populated?
Good luck!!
Regards
That was what concerned me at first glance.However there is a condition that the sum of the 7 numbers in each combination must equal 161.
I'm guessing that this should seriously reduce the number of integers that needs to be considered, For instance we can immediately rule out anything above 140.
Then I'm also surmising that we may be able to use the information that the average of any 7 must be 23. Still thinking of some sort of algorithm.
Last edited by Richard Buttrey; 06-14-2015 at 06:59 AM.
Richard Buttrey
RIP - d. 06/10/2022
If any of the responses have helped then please consider rating them by clicking the small star iconbelow the post.
Can we? I think you mean more that we can rule out cases where all 6 numbers are less than 29 (I think you mean this number, not 17?).
Because e.g. the number 1 cannot be ruled out per se.
But how this helps I'm not quite sure, since it may in any case require that all combinations of those values are first enumerated before then applying a conditional statement on that list to the effect of eliminating those which don't meet these criteria.
Regards
Yes, quite correct. I had in fact edited my post.
It's also the case that any 7 consecutive numbers below 25 can be excluded. However I grant you that somehow disallowable combinations have in some way to be excluded before processing the rest of the combinations and that's certainly not clear to me.
shg's usually good at this sort of stuff. Maybe he'll have some ideas.
Hi arunsjain,
This looks like one of your previous post. As mentionned by the other, there are probably too many possibilities
Here's a slightly modified version of the code I provided you the first time.
You can change the value of n to do more iterations but this may take more time and/or crash Excel.
![]()
Please Login or Register to view this content.
GC Excel
If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.
I've been working on the very topic lately, but it tends to make my brain explode.
I've got functions to count and generate all of the partitions of a number. For example, the partitions of 8 are
8
7+1
6+2
6+1+1
5+3 5+2+1
5+1+1+1 4+4
4+3+1 4+2+2 4+2+1+1
4+1+1+1+1
3+3+2 3+3+1+1
3+2+2+1 3+2+1+1+1
3+1+1+1+1+1
2+2+2+2 2+2+2+1+1
2+2+1+1+1+1
2+1+1+1+1+1+1
1+1+1+1+1+1+1+1
For 161, there are 118,159,068,427.
I also have a function to calculate the number of partitions that include only distinct numbers (aka strict partitions). For the number 13, for example, there are 18:
13
12 + 1
11 + 2
10 + 3
9 + 4
8 + 5
7 + 6
10 + 2 + 1
9 + 3 + 1
8 + 4 + 1
7 + 5 + 1
8 + 3 + 2
7 + 4 + 2
6 + 5 + 2
6 + 4 + 3
7 + 3 + 2 + 1
6 + 4 + 2 + 1
5 + 4 + 3 + 1
For 161, there are 15,065,878,135 strict partitions.
What I don't have is a function to calculate the number of strict partitions of a given length (e.g., a function that returns 3 for (13, 4), and some unknown number for (161, 7)). I know what the generating function is, but can't get my brain around how to evaluate it.
Whatever the number is, though, listing them would take way more than a full column, and that interests me not at all.
Last edited by shg; 06-14-2015 at 05:58 PM.
Entia non sunt multiplicanda sine necessitate
Have some light amusement with this code if you like.
It took my computer 34 secs to produce a million of the results that you seem to want.
I don't particularly want to work out the total number of results needed, but you can overflow more (than the million) results into additional columns of your worksheet if you feel like it, and wait until you either run out of patience or your computer runs out of memory. I'd also note that the code isn't particularly efficient.![]()
Please Login or Register to view this content.
Thank you all for your time and reply. Highly appreciated.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks