Thread: how to enumerate all permulations

  1. #1
    Registered User
    Join Date
    Dec 2008

    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.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    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:
    500 GB hard-disks to store the result.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Toronto, ON
    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.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  4. #4
    Join Date
    Jan 2009
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enumerate all
    By geek@02 in forum Windows Programming
    Replies: 7
    Last Post: 06-14-2004, 05:57 PM
  2. [code] Enumerate IE instances and retrieve interfaces.
    By anonytmouse in forum Windows Programming
    Replies: 1
    Last Post: 05-05-2004, 08:01 AM
  3. Enumerate ALL CD-drives
    By Steph in forum Windows Programming
    Replies: 3
    Last Post: 06-04-2003, 12:24 AM
  4. Enumerate type
    By dv007 in forum C Programming
    Replies: 8
    Last Post: 07-15-2002, 03:32 PM
  5. Replies: 1
    Last Post: 05-28-2002, 11:20 AM