![]() |
How to cycle all possible permutations
I want to try every combination of 10 numbers out of 1 to 64 (I reckon
there are about 1,300 odd but that is just my intuitive guess rather than any mathematical knowledge. I should think there is a for...next loop over a few layers that would do it but I cannot for the life of me figure it out not having a maths background. Can anyone help me out? Kind regards, mark |
How to cycle all possible permutations
Ouch!
=COMBIN(64,10) returns: 151,473,214,816 Unless I misunderstood the question, this seems like too much. Are you trying to calculate something else? HTH Dana DeLouis "Mark" wrote in message m... I want to try every combination of 10 numbers out of 1 to 64 (I reckon there are about 1,300 odd but that is just my intuitive guess rather than any mathematical knowledge. I should think there is a for...next loop over a few layers that would do it but I cannot for the life of me figure it out not having a maths background. Can anyone help me out? Kind regards, mark |
How to cycle all possible permutations
1300? you must either be dreaming or mean something entirely different..
=COMBIN(64,10) = 151,473,214,816 =PERMUT(64,10) = 549,666,001,924,301,000 keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool (Mark) wrote: I want to try every combination of 10 numbers out of 1 to 64 (I reckon there are about 1,300 odd but that is just my intuitive guess rather than any mathematical knowledge. I should think there is a for...next loop over a few layers that would do it but I cannot for the life of me figure it out not having a maths background. Can anyone help me out? Kind regards, mark |
How to cycle all possible permutations
I think there are many more than 1,300...this would generate the #'s
believe but try it first with just the references to variables a and active as shown Sub Macro1() ' z = 1 For a = 1 To 55 For b = a + 1 To 56 'For c = b + 1 To 57 'For d = c + 1 To 58 'For e = d + 1 To 59 'For f = e + 1 To 60 'For g = f + 1 To 61 'For h = g + 1 To 62 'For i = h + 1 To 63 'For j = i + 1 To 64 Cells(z, 1) = a Cells(z, 2) = b 'Cells(z, 3) = c 'Cells(z, 4) = d 'Cells(z, 5) = e 'Cells(z, 6) = f 'Cells(z, 7) = g 'Cells(z, 8) = h 'Cells(z, 9) = i 'Cells(z, 10) = j z = z + 1 'Next j 'Next i 'Next h 'Next g 'Next f 'Next e 'Next d 'Next c Next b Next a End Su -- Message posted from http://www.ExcelForum.com |
How to cycle all possible permutations
Mark;
You could undoubtedly program a loop to do this, but it would take a long time to run. When selecting 10 numbers out of 64, there are 151,473,214,816 combinations, and a whopping 549,666,001,924,301,000 permutations (if the order of selection of the 10 numbers matters). You can derive these numbers using factorials, or do what I did and use the built in COMBIN and PERMUT excel functions. e.g =COMBIN(64,10). You might want to consider if there is another way of tackling your problem. David Sauder (Mark) wrote in message om... I want to try every combination of 10 numbers out of 1 to 64 (I reckon there are about 1,300 odd but that is just my intuitive guess rather than any mathematical knowledge. I should think there is a for...next loop over a few layers that would do it but I cannot for the life of me figure it out not having a maths background. Can anyone help me out? Kind regards, mark |
How to cycle all possible permutations
"David Sauder" wrote...
. . . When selecting 10 numbers out of 64, there are 151,473,214,816 combinations, and a whopping 549,666,001,924,301,000 permutations (if the order of selection of the 10 numbers matters). .... Permutation count incorrect. There are 549,666,001,924,300,800 permutations of 10 items from 64. Your figure is affected by Excel's 15 decimal digit precision limit. |
How to cycle all possible permutations
Dear Duane, Yep, that looks like exactly what I need, will try it (and cut down on the numbers which are somewhat larger than I had anticipated). Thanks very much for your input. Kind regards, Mark *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
How to cycle all possible permutations
"Mark Stephens" wrote...
Yep, that looks like exactly what I need, will try it (and cut down on the numbers which are somewhat larger than I had anticipated). Thanks very much for your input. Kind regards, Mark Somewhat larger than you had anticipated! You lack mathematical intuition, and any other form of intuition is useless in mathematics. I'm not trying to be nasty (some would say it's effortless for me), what I mean is that *you* can't guess about this. You're going to need to design what you're trying to do carefully. You'll need to do some heavy adaptation of duane's code because Excel worksheets have only 16,777,216 cells per worksheet, and cutting down your originally proposed 10 items from 64 to something that would fit into a single worksheet will be a challenge since there are more than 28 million combinations of 9 items out of 32. So just how much can you whittle away at your original specs? |
How to cycle all possible permutations
On 17 Jul 2004 15:30:33 -0700, Mark wrote:
I want to try every combination of 10 numbers out of 1 to 64 (I reckon there are about 1,300 odd but that is just my intuitive guess rather than any mathematical knowledge. I should think there is a for...next loop over a few layers that would do it but I cannot for the life of me figure it out not having a maths background. Can anyone help me out? Kind regards, mark Can you clarify a bit exactly what you want? I know it may seem pretty clear, but before I post my (pretty ridiculous-looking) reply, I'd like to verify that I'm not way out in left field. I'm interested in that 1,300 figure of yours - if I'm correct in my thinking of what you want, it's closer to a quarter-quintillion... so to prevent me from wasting time and bandwidth with a possibly "what the hell is that" answer, please clarify. -- auric underscore underscore at hotmail dot com ***** You see, I am over here, on this page where normal people live and work and play... while you, on the other hand, are waaaay over here, not only on a different page but quite possibly in a whole other library... |
How to cycle all possible permutations
Duane already posted a macro to do it and others have established that the
number would be much larger. -- Regards, Tom Ogilvy "Auric__" wrote in message ... On 17 Jul 2004 15:30:33 -0700, Mark wrote: I want to try every combination of 10 numbers out of 1 to 64 (I reckon there are about 1,300 odd but that is just my intuitive guess rather than any mathematical knowledge. I should think there is a for...next loop over a few layers that would do it but I cannot for the life of me figure it out not having a maths background. Can anyone help me out? Kind regards, mark Can you clarify a bit exactly what you want? I know it may seem pretty clear, but before I post my (pretty ridiculous-looking) reply, I'd like to verify that I'm not way out in left field. I'm interested in that 1,300 figure of yours - if I'm correct in my thinking of what you want, it's closer to a quarter-quintillion... so to prevent me from wasting time and bandwidth with a possibly "what the hell is that" answer, please clarify. -- auric underscore underscore at hotmail dot com ***** You see, I am over here, on this page where normal people live and work and play... while you, on the other hand, are waaaay over here, not only on a different page but quite possibly in a whole other library... |
How to cycle all possible permutations
On Sat, 17 Jul 2004 21:57:40 -0700, Harlan Grove wrote:
"David Sauder" wrote... . . . When selecting 10 numbers out of 64, there are 151,473,214,816 combinations, and a whopping 549,666,001,924,301,000 permutations (if the order of selection of the 10 numbers matters). ... Permutation count incorrect. There are 549,666,001,924,300,800 permutations of 10 items from 64. Your figure is affected by Excel's 15 decimal digit precision limit. Whoo! 200 less! Now it seems so plausible! <g Just for kicks, I tested the nested for-next loops - no output, mind you, just a single variable assignment (o&=a & b & ... & j) and after 60 seconds, it had done something like 10 million. At that rate, it would only take ~10-1/2 days to finish the whole problem. [rolls eyes] -- auric underscore underscore at hotmail dot com ***** There was a war... a war that set the sky on fire. |
How to cycle all possible permutations
Auric__ wrote...
Harlan Grove wrote: "David Sauder" wrote... ... . . . and a whopping 549,666,001,924,301,000 permutations ... Permutation count incorrect. There are 549,666,001,924,300,800 permutations. . . . ... Whoo! 200 less! Now it seems so plausible! <g Sarcasm aside, problems such as this are better handled with softwar that uses arbitrary precision. Or did you suppose I calculated th exact permutation count manually? Now try storing your intermediate results -- Message posted from http://www.ExcelForum.com |
How to cycle all possible permutations
On Sun, 18 Jul 2004 22:27:57 -0400, Tom Ogilvy wrote:
Duane already posted a macro to do it and others have established that the number would be much larger. Yes, I know. My @#$% ISP is having "issues" with their servers... -- auric underscore underscore at hotmail dot com ***** Before the internet, the village idiot would stay in his own village. |
All times are GMT +1. The time now is 05:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com