User3141592
New member
- Joined
- Jul 13, 2022
- Messages
- 3
I'm not sure this is quite the right place to put this, but I wasn't sure where else would be more appropriate.
I'm trying to generate all unique expressions (and their solutions, but the solutions need not [and in fact cannot] be unique) of a certain length of sums, sums of products, and products, from a list of addends and multiplicands.
The expression must always start with an addend, and the operator between any two numbers is determined by which list it comes from + for addend and * for multiplicand.
For example, say my list of addends A is 1,2,3,4,5 and my list of multiplicands M is 2,3,4, and I want all expressions of length 3.
I want:
a+a+a
a+a*m (commutatively equivalent to a*m+a)
a*m*m
for all commutatively unique arrangements of A and M. So of 1+1+2, 1+2+1, and 2+1+1 only one would appear in the final set.
This example would be pretty trivial to solve in excel; the numbers I'm actually working with are much larger making brute forcing it would take several days of sustained effort. I thought maybe someone cleverer mathematician than I would know a better way.
I'm trying to generate all unique expressions (and their solutions, but the solutions need not [and in fact cannot] be unique) of a certain length of sums, sums of products, and products, from a list of addends and multiplicands.
The expression must always start with an addend, and the operator between any two numbers is determined by which list it comes from + for addend and * for multiplicand.
For example, say my list of addends A is 1,2,3,4,5 and my list of multiplicands M is 2,3,4, and I want all expressions of length 3.
I want:
a+a+a
a+a*m (commutatively equivalent to a*m+a)
a*m*m
for all commutatively unique arrangements of A and M. So of 1+1+2, 1+2+1, and 2+1+1 only one would appear in the final set.
This example would be pretty trivial to solve in excel; the numbers I'm actually working with are much larger making brute forcing it would take several days of sustained effort. I thought maybe someone cleverer mathematician than I would know a better way.