We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Can't work out the forumula for this (SOLVED)

Options
2

Comments

  • PHK
    PHK Posts: 2,274 Forumite
    Eighth Anniversary 1,000 Posts Photogenic Name Dropper
    But the question you've asked is not the same as the question in your opening post ?
  • TryingToWork
    TryingToWork Posts: 97 Forumite
    Part of the Furniture 10 Posts Name Dropper Combo Breaker
    edited 14 February 2024 at 7:36AM
    PHK said:
    But the question you've asked is not the same as the question in your opening post ?
    Yes you're right. I didn't know how to ask the AI that without showing it the picture! (Do AIs know pictures? I guess if they did, then Captchas wouldn't work, would they?!)

    I said in one of my later posts that if the sections made the whole thing too complicated, then I was willing to settle for mixing up all 12 letters without the sections. And I reckoned the AI would like a simple request. But even that was too hard. I am currently learning Python on YouTube, as the AI gave me the code for that.

  • MeteredOut
    MeteredOut Posts: 3,037 Forumite
    1,000 Posts Second Anniversary Name Dropper
    edited 14 February 2024 at 12:03PM
    ChatGPT solution for all permutations of x characters in a string

    "write some javascript code which takes a string of 12 characters and displays all possible permutations"

    function generatePermutations(inputString) {
        const permutations = [];

        function permute(prefix, remaining) {
            if (prefix.length === inputString.length) {
                permutations.push(prefix);
            } else {
                for (let i = 0; i < remaining.length; i++) {
                    permute(prefix + remaining[i], remaining.slice(0, i) + remaining.slice(i + 1));
                }
            }
        }

        permute('', inputString);
        return permutations;
    }

    const inputString = 'abcdefghijk'; // Replace this with your 12-character string
    const allPermutations = generatePermutations(inputString);
    console.log(allPermutations.length); // Number of permutations
    console.log(allPermutations); // Output all permutations

    "do the same, but in python"

    from itertools import permutations

    def generate_permutations(input_string):
        return [''.join(perm) for perm in permutations(input_string)]

    input_string = 'abcdefghijk'  # Replace this with your 12-character string
    all_permutations = generate_permutations(input_string)
    print(len(all_permutations))  # Number of permutations
    print(all_permutations)  # Output all permutations


    Note that both solutions only use 11 characters, and both display 39916800 (11 factorial) and then the permutations.

    When I change both solution to 12 character strings, its timing out on my local machine due to depth of recursion required. Don't underestimate the processing power needed to get all 479 million combinations.
  • MeteredOut
    MeteredOut Posts: 3,037 Forumite
    1,000 Posts Second Anniversary Name Dropper
    PHK said:
    But the question you've asked is not the same as the question in your opening post ?
    Yes you're right. I didn't know how to ask the AI that without showing it the picture! (Do AIs know pictures? I guess if they did, then Captchas wouldn't work, would they?!)

    I said in one of my later posts that if the sections made the whole thing too complicated, then I was willing to settle for mixing up all 12 letters without the sections. And I reckoned the AI would like a simple request. But even that was too hard. I am currently learning Python on YouTube, as the AI gave me the code for that.

    This is going to sound harsh, but if you can't work out how to ask an AI bot to write the code, then you're not going to be able to write the code yourself. The challenge here will not be learning Python, but in defining the logic required to decide what Python to write.
  • Grumpy_chap
    Grumpy_chap Posts: 18,218 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Combo Breaker
    edited 14 February 2024 at 12:55PM

    I make puzzles. I don't make money from them, but I hope to release a free app of them soon. 


    Don't underestimate the processing power needed to get all 479 million combinations.
    I don't know how this puzzle is meant to work but, with 479 million possible answers it seems somewhat adrift from a successful hit like Wordle.

    EDIT - I just did an internet search for "how many five letter words English language?" and the results suggest between 13k and 160k words.  I suspect the higher number of possible Wordle solutions is more likely.
  • MeteredOut
    MeteredOut Posts: 3,037 Forumite
    1,000 Posts Second Anniversary Name Dropper

    I make puzzles. I don't make money from them, but I hope to release a free app of them soon. 


    Don't underestimate the processing power needed to get all 479 million combinations.
    I don't know how this puzzle is meant to work but, with 479 million possible answers it seems somewhat adrift from a successful hit like Wordle.
    To be fair, the original query was for a subset, where the letters were within 4 groups and each letter is only swapped with letters from the other 3 groups.

    Still a lot of permutations though....

  • Thank you all. 

    The code and Grumpy_chap said:

    I make puzzles. I don't make money from them, but I hope to release a free app of them soon. 


    Don't underestimate the processing power needed to get all 479 million combinations.
    I don't know how this puzzle is meant to work but, with 479 million possible answers it seems somewhat adrift from a successful hit like Wordle.

    The formula / code I was asking about refers to coming up with creating the solution words for the puzzle, not the puzzle itself. There are a lot fewer (sometimes only ONE!) solutions to the puzzle itself. 

    It has a tenuous link to Wordle in that it is a hexagonal version of Letterboxed, another NYT puzzle. I linked to it in a previous thread here


    This is going to sound harsh, but if you can't work out how to ask an AI bot to write the code, then you're not going to be able to write the code yourself. The challenge here will not be learning Python, but in defining the logic required to decide what Python to write.


    Not harsh. I asked for help and you've all been very helpful. 

    I now realise it would be impossible to use all 4 million permutations, or even to continue this idea. So I will just put the puzzle words in manually like I have been doing. Even doing them manually, I am finding lots of decent word pairings that will do for the puzzles. And I already have enough for over 400 future puzzles, so I'm not going to run out. I just wondered if there was a way to make the process faster. 

    And the answer was No!

    But I appreciate everyone's help, thank you


  • [Deleted User]
    [Deleted User] Posts: 0 Newbie
    Part of the Furniture 100 Posts Name Dropper Photogenic
    edited 28 April 2024 at 9:34PM
    Hi, please can someone tell me the formula for working out how to get every possible combination* of all the following 12 letters?

    * (They don't need to be swapped within their own section. The order within each section does not matter. So in the LEFT section S does not need to be swapped with i, for example. Only need them swapped from different sections).



    I started doing it manually (by swapping two letters from each section to another section, and putting them back, and swapping two more) but then I realised there are a LOT more combinations that I thought. I now realise there could be hundreds!

    But how do I find out all of them?

    I'm not mathematically minded at all. Got a D in Maths GCSE.

    Thanks a lot
    I asked my AI to provide a solution for you and it came up with this ...hope it helps.

  • MeteredOut
    MeteredOut Posts: 3,037 Forumite
    1,000 Posts Second Anniversary Name Dropper
    edited 31 October 2024 at 1:25PM
    Hi, please can someone tell me the formula for working out how to get every possible combination* of all the following 12 letters?

    * (They don't need to be swapped within their own section. The order within each section does not matter. So in the LEFT section S does not need to be swapped with i, for example. Only need them swapped from different sections).



    I started doing it manually (by swapping two letters from each section to another section, and putting them back, and swapping two more) but then I realised there are a LOT more combinations that I thought. I now realise there could be hundreds!

    But how do I find out all of them?

    I'm not mathematically minded at all. Got a D in Maths GCSE.

    Thanks a lot
    I asked my AI to provide a solution for you and it came up with this ...hope it helps.

    Do you think that solution helps?
  • [Deleted User]
    [Deleted User] Posts: 0 Newbie
    Part of the Furniture 100 Posts Name Dropper Photogenic
    edited 31 October 2024 at 1:25PM
    Hi, please can someone tell me the formula for working out how to get every possible combination* of all the following 12 letters?

    * (They don't need to be swapped within their own section. The order within each section does not matter. So in the LEFT section S does not need to be swapped with i, for example. Only need them swapped from different sections).



    I started doing it manually (by swapping two letters from each section to another section, and putting them back, and swapping two more) but then I realised there are a LOT more combinations that I thought. I now realise there could be hundreds!

    But how do I find out all of them?

    I'm not mathematically minded at all. Got a D in Maths GCSE.

    Thanks a lot
    I asked my AI to provide a solution for you and it came up with this ...hope it helps.

    Do you think that solution helps?
    What I would do, is have a go myself. The difficulty is having somebody with relevant experience check it for me. It would be quite embarassing to publish especially if associated with a prize. The machine is simply a tool that is validating its own answer. The final decision to publish is whether you are able to trust the answer. On the issue of GCSE D math, its about the norm but there should be enough skill in oneself to let the machine help develop or improve skills. Perplexity alway provides links from where it scraped the data so check them out.

Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253.1K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.8K Work, Benefits & Business
  • 598.7K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 257.1K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.