Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Parens permutations

by Limbic~Region (Chancellor)
on Aug 05, 2003 at 05:44 UTC ( [id://280888]=note: print w/replies, xml ) Need Help??


in reply to Parens permutations

artist,
Please forgive me as I am incredibly tired, but I originally told you in the CB this sounded like a math problem. Unfortunately I do not believe it is a simple algebraic formula. Lets change n=123 to n=3 since you are talking about a 3 digit number. Now we have a few problems.

Problem number 1: The equation to determine the number of permutations seems to change with p.
p = 1
permutations = ((n2 + n)/ 2)

p = 2
let k = ((n2 + n)/ 2)
permutations = ((k2 + k)/ 2)

Second problem: There can be some ambiguity in what we are actually grouping:

(1 (2) 3)
Can be seen as either 1 & 3 + 2 or 1 & 2 + 2 & 3. This breaks the formula for p = 2 since:
p = 2 n = 3 k = 6 permutations = 21
is not correct as barrachois pointed out - it is actually 20 since two permutations, while different, look the same.

I didn't bother going any further than this to see if the simple formulas for different values of p could be generalized.

Sorry - L~R

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://280888]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found