Results 1 to 10 of 10
  1. #1
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Permutations (A2k)

    I have a range consisting of 40 cells - 8 rows by 5 columns. Each row consists of 5 digits. I need to display every permutation of one digit taken from each row to form a series of rows each containing eight digits. I hope I've phrased my requirements comprehensibly. Would any kind soul supply some code to achieve this?
    TIA.
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Permutations (A2k)

    Rob,

    Designing a new puzzle <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>?

    I hope you realise that there are 5 to the power 8 = 390625 possible choices (if the digits in a row are different). You say you want to display them all - that's going to take time! And it exceeds the max number of 65536 rows in a worksheet.

    What do you want to achieve?

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Permutations (A2k)

    If I understand:

    You have 8 rows and 5 cols. each cell of this 8x5 matrix contains 1 number.
    You want to take 1 number (out of the 5 columns) from each row and combine them into 1 8-digit number.

    You want all the permutations (I calculate 5^8 permutations = 390,625) of this?

    Where do you want the results and how do want them displayed. Do you want the list in any sort of Matrix (25 col x 15,625 rows; or 125 col x 3,125 rows) or just fill a column and when it gets full to just go to the next column (and this will take just shy of 6 FULL excel columns to list them.)

    Steve

  4. #4
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Permutations (A2k)

    Very astute, Hans, but not quite. After a long day, to my shame, I'm trying to take the easy way out and use any such code to help me solve puzzles of a particular type - sort of defeats the object really. I shall rely on my brain to filter out the nonsense combinations and attack the problem anew, tomorrow. Still, a general approach to such problems would be useful for future projects and if you have the time or inclination your thoughts would be valued. But at your leisure: you have more important problems to focus on. <img src=/S/newbrain.gif border=0 alt=newbrain width=21 height=22>
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  5. #5
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Permutations (A2k)

    Sorry Steve! I had a rush of blood to the foot (where my brain resides).Your post arrived mid-reply to Hans.
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Permutations (A2k)

    If there are not 5^8 permutations, what combinations are not used?

    What kind of puzzles are you trying to solve? It is sometimes an interesting puzzle to try to figure generic algorithms for solving puzzles.

    Steve

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Permutations (A2k)

    Steve,

    I think that Rob (bandido) was trying to solve the puzzle in <post#=230187>post 230187</post#> in the Puzzles forum by brute force.

  8. #8
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Permutations (A2k)

    Hans,
    Ok that explains the reason, though I still say there are 5^8 permutations, the way he stated it.

    I guess he could mean that he already has the 8 letters (1 from each row) removed (to leave the 8 NEW words) and wants the 8! =40,320 combinations of those 8 letters.

    Steve

  9. #9
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Permutations (A2k)

    <img src=/S/cop.gif border=0 alt=cop width=15 height=24> I love it! I've got you reaching for permutations...

    Since the word BREAD contains many possibilities, I'll tell you that you can grab the A and move on... <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>
    - Ricky

  10. #10
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Permutations (A2k)

    Steve,
    I originally wanted to find out how many valid, eight letter English words I could create by taking one letter from each row. However, I solved Ricky's puzzle very quickly by visual inspection.
    It was how you would approach this type of problem using Excel, VB or both that intrigued me.
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •