• Permutations (A2k)

    Author
    Topic
    #384108

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #657524

      Rob,

      Designing a new puzzle evilgrin?

      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?

      • #657532

        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. newbrain

        • #657591

          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

          • #657598

            Steve,

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

            • #657603

              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

            • #657699

              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.

        • #657636

          cop 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… evilgrin

    • #657527

      If I understand:

      You have 8 rows and 5 cols. each cell of this 8×5 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

      • #657535

        Sorry Steve! I had a rush of blood to the foot (where my brain resides).Your post arrived mid-reply to Hans.

    Viewing 1 reply thread
    Reply To: Permutations (A2k)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: