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