# number of ways evaluation of expression such that value not changed [closed]

one example:

How many ways we can do possible value-preserving parenthesis the following expression in such a way that value not changed after parenthesis with one constraint that parenthesis among one variable is not correct (i.e: $$(i)+j+k$$ is not acceptable) ?

as an example for expression $$i+j+k$$, parenthesis like $$i+(j+k)$$, $$((i+j)+k)$$ are correct parenthesis but $$(i)+j+k$$ is not. I take a complete short example as follows.

• I think your definition of "correct parenthesis" needs to be made more precise. Why, for example, is $(i)$ excluded and not $((i+j))$? Also, are $i+j+k$ and $(i+j)+k$ different, even though the second one just shows the consequence of the conventional rules for parsing? Similarly, do the redundant outer parentheses in $((i+j)+k)$ really create a different expression than $(i+j)+k$? – rici Dec 27 '20 at 17:06
• $i+j-k$ has only two complete parenthesizations, corresponding to the two possible parse trees. The number of evaluations of an unparenthedized binary expression with $k$ operators, or equivalently the number of balanced parenthesis strings with $k$ pairs of parentheses, is given by $C_k$, the $k_{th}$ Catalan number. (The linked wikipedia article has lots of info and useful links). Your (rather unclear) definition double-counts, so its less combinatorically useful. – rici Dec 27 '20 at 20:15
• And your statement that "each operator can have parentheses or not" undercounts the possible arrangements, since parentheses do not have a single possible location for an operator. The Catalan numbers griw more rapidly than powers of two; $C_5 = 42$ and $C_6 = 132$. – rici Dec 27 '20 at 20:18
• You still don't define "correct parentheses". Also this is disorganized. Also it's not clear what question you are trying to ask. PS Please clarify via edits, not comments. Please delete & flag unneeded comments. – philipxy Dec 28 '20 at 1:42
• Do not edit your question to remove its content. That is considered "vandalism" on Stack Exchange. – D.W. Jan 24 at 16:32