perlquestion randyk <p> I have an expansion involving <tt>N</tt> factors: <code> (a + a) (a + a) (a + a) ... (a[N-1] + a[N-1]) </code> for which I'm trying to find general expressions for the <tt>2^N</tt> terms involved when this is all multiplied out. Getting an expression for two of the terms is straightforward when the 2nd indices of the <tt>a</tt> coefficients are the same: <code> \$C = 1; \$C[\$N-1] = 1; for (\$i=0; \$i<\$N; \$i++) { \$C *= \$a->[\$i]->; \$C[\$N-1] *= \$a->[\$i]->; } </code> but I'm stuck on the problem of getting the other terms. Can someone see a way to do this? Thanks. </p><p> UPDATE<br /> Just to clarify the notation, what's desired is expressions for the <tt>2**N</tt> coefficients of the expansion. For example, for <tt>N = 2</tt> factors and <tt>2**N = 4</tt> terms: <code> (a + a) * (a + a) = C + C + C + C, where C = a * a C = a * a C = a * a C = a * a </code> No meaning is intended for the order of the indices of the <tt>C</tt> array. There's a number of approaches suggested below that will get me going - thanks to all who responded! </p>