Jump to content

First of all I'm no mathematician. Second of all I have the answers to my problem.  What I'm after is a formula, not because I need it, rather because I'm infuriated by not being able to come up with one myself. The problem is this:

 

Given any combination of letters (as in a word), come up with all the possible permutations and combinations.  That's fairy straight forward to solve using a factorial (think that's what's called). for example the word 'hello' gives you 120 ways of arranging all 5 letters into unique positions (5! = 120 and ignoring the double 'l'). What I'm after though, is how many unique combinations can you have including combination that are made up with less letters.  For example the word 'fox' gets you 15 such possibilities.  I won't list all of them, but basically you combine all the letters in which ever way, so even the letter 'x' on its own is a viable result.  I know that for 4 letters you have 64 such combinations, for 5 170 and for 6 you end up with 1050. 

 

I don't need to go to infinity, i just need to go as far as the longest word in the English language (not sure which particular variant just yet, but probably British English).

 

The reason I'm doing this:  Simple - I was reading Dan Browns The Davinici Code and there the main female's characters grandfather was dishing our word puzzles and of of them was how many words can you form from all the letters in a given word.  So i thought I'd code up something like that, which wasn't difficult, but now i'm struggling with a formula.  The code I have does find all the possible word combinations for a given word, but I'm obsessed with knowing a formula.  I've look at formulas for permutations and combinations but all I've found is suggestions that always give you the same number of letters.  I think my case is a bit more complex, but since I'm not a mathematician, I can't get my brain around a formula for it.

 

Any help is appreciated!

work rig

cpu: AMD 5800X mb: Pro WS X570-ACE cooling: NH-D15 ram: 32GB Corsair 3200mhz ssd: Samsung 970 Pro 512GB, 860 Evo 512GB   hdd: 4TB Seagate, 320GB gpu: Asus RTX-1060 6GB psu: Corsair RM750x display: Philips 32" 4K case: Fractal Design Define R6 Black

 

home lab and NAS

cpu: Xeon E5-2697 v2 (12c/24t) mb: Rampage 4 Black Edition cooling: Hyper 212 EVO ram: 64GB Corsair 1866mhz ssd: 2x Intel DC S4610 (480GB), 2x Intel DC P3605 (1.6 TB)  hdd: 4x Seagate IronWolf 4TB CMR, Seagate Exos 7E8 8TB, WD VelociRaptor 10K 450GB  gpu: Asus GTX-660 psu: Corsair HX850i case: Corsair 750D

Link to comment
https://linustechtips.com/topic/1228819-help-with-a-math-problem/
Share on other sites

Link to post
Share on other sites

You need to find the number of possible permutations of 1 letter out of a set of 5 letters, then add the permutations of 2 letters out of a set of 5 letters and so on up until 5.

 

There are  n!/(n-k)! possible permutations of k letters out of a set of n letters. What you want is

 

image.png.80c769b5a997664d6859234cb3b3e60e.png

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to post
Share on other sites

1 hour ago, Sauron said:

You need to find the number of possible permutations of 1 letter out of a set of 5 letters, then add the permutations of 2 letters out of a set of 5 letters and so on up until 5.

 

There are  n!/(n-k)! possible permutations of k letters out of a set of n letters. What you want is

 

image.png.80c769b5a997664d6859234cb3b3e60e.png

 

That did the trick! thank you!  Now you can go back to trying to take over middle earth.

work rig

cpu: AMD 5800X mb: Pro WS X570-ACE cooling: NH-D15 ram: 32GB Corsair 3200mhz ssd: Samsung 970 Pro 512GB, 860 Evo 512GB   hdd: 4TB Seagate, 320GB gpu: Asus RTX-1060 6GB psu: Corsair RM750x display: Philips 32" 4K case: Fractal Design Define R6 Black

 

home lab and NAS

cpu: Xeon E5-2697 v2 (12c/24t) mb: Rampage 4 Black Edition cooling: Hyper 212 EVO ram: 64GB Corsair 1866mhz ssd: 2x Intel DC S4610 (480GB), 2x Intel DC P3605 (1.6 TB)  hdd: 4x Seagate IronWolf 4TB CMR, Seagate Exos 7E8 8TB, WD VelociRaptor 10K 450GB  gpu: Asus GTX-660 psu: Corsair HX850i case: Corsair 750D

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×