We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
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
Comments
-
But the question you've asked is not the same as the question in your opening post ?2
-
PHK said:But the question you've asked is not the same as the question in your opening post ?
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.
0 -
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 stringconst allPermutations = generatePermutations(inputString);console.log(allPermutations.length); // Number of permutationsconsole.log(allPermutations); // Output all permutations"do the same, but in python"from itertools import permutationsdef generate_permutations(input_string):return [''.join(perm) for perm in permutations(input_string)]input_string = 'abcdefghijk' # Replace this with your 12-character stringall_permutations = generate_permutations(input_string)print(len(all_permutations)) # Number of permutationsprint(all_permutations) # Output all permutationsNote 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.1
-
TryingToWork said:PHK said:But the question you've asked is not the same as the question in your opening post ?
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.3 -
TryingToWork said:
I make puzzles. I don't make money from them, but I hope to release a free app of them soon.MeteredOut said:Don't underestimate the processing power needed to get all 479 million combinations.
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.3 -
Grumpy_chap said:TryingToWork said:
I make puzzles. I don't make money from them, but I hope to release a free app of them soon.MeteredOut said:Don't underestimate the processing power needed to get all 479 million combinations.
Still a lot of permutations though....
2 -
Thank you all.
The code and Grumpy_chap said:TryingToWork said:
I make puzzles. I don't make money from them, but I hope to release a free app of them soon.MeteredOut said:Don't underestimate the processing power needed to get all 479 million combinations.
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.@MeteredOut said: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
1 -
TryingToWork said: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
0 -
[Deleted User] said:TryingToWork said: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 lot0 -
MeteredOut said:[Deleted User] said:TryingToWork said: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
0
Confirm your email address to Create Threads and Reply

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