# how to enumerate all permulations

• 01-12-2009
patiobarbecue
how to enumerate all permulations
dear there,

This seems like an easy one, but I haven't get it work yet -:)
I have 1747 bins, each bin can have number 1,2,...43, and I need to list all possible permutations. There are 43^1747 of them! Ideally the algorithm should list 1,1,...1 as the first output, followed by 1,1....,2, i.e., the permutation with small numbers should be generated first, since given a permutation I will evaluate another bool expression, and terminate on the first true. I wrote a recursive version and it doesn't work for such large number. Any suggestions? Thanks.
• 01-12-2009
matsp
I'm not sure, but I suspect even the most fastest super-cluster would struggle to achieve it in our lifetime, considering that 43^1747 is 4.6708067325977701373103737869361e+2853

Note that if you can produce one permutation per clock-cycle on a 4GHz processor, you are still looking at 3.7027577471760608013939416753362e+2836 years. Or put another way, 3.7027577471760608013939416753362e+2830 million years - that is a VERY LONG TIME. I'm not going to be alive to see the result, no matter what method you use.

I'm also not sure where you intent to store all those results. You need:
9.3416134651955402746207475738721e+2841
500 GB hard-disks to store the result.

--
Mats
• 01-12-2009
cpjust
First -- what on earth are you trying to accomplish?
Depending on what you're doing, you might be able to scale down the problem into something that's actually solvable.
• 01-12-2009
sphynxter
Some password crackers try similar types of brute-force permutations in order to force their way in. Would you be trying to accomplish such a feat? I would imagine depending on what you are doing there may be ways to streamline the process or maybe even go about it entirely differently.