# Is there an Iterative solution to a variable length problem?

GROUPS:
 Paul Cleary 1 Vote I am looking for an efficient way to evaluate a set of variable length variables, if I can explain. Lets say I have 2 lists b = {2,3,7,11,...i}; c = {3,2,2,4,...n}. both lists will always be the same length, but will vary in length and have different numbers. I now wish to calculate in this example, x = 2^(0 to 3) x 3^(0 to 2) x 7^(0 to 2) x 11^(0 to 4) x ... i^(0 to n). So in the case of this example if we just had the 4 numbers as shown we would generate 180 individual values for c. At the moment I have separate 'modules' dependent on the length of the list. I am wondering if Mathematica can handle this without the need to re-direct.   this is part of my program that deals with the length of the lists.If[la==1,list=Reap[Do[x=b[[1]]^p b[[2]]^q;Sow[x],{p,0,c[[1]]},{q,0,c[[2]]}]];list=Union[Select[Flatten[list[[2]]],#<=2m&]];list=list+4m;Print[Length[list]];Print[Column[f[list]]];Abort[]];If[la==2,list=Reap[Do[x=b[[1]]^p b[[2]]^q b[[3]]^r;Sow[x],{p,0,c[[1]]},{q,0,c[[2]]},{r,0,c[[3]]}]];list=Union[Select[Flatten[list[[2]]],#<=2m&]];list=list+4m;Print[Length[list]];Print[Column[f[list]]];Abort[]];If[la==3,list=Reap[Do[x=b[[1]]^p b[[2]]^q b[[3]]^r b[[4]]^s;Sow[x],{p,0,c[[1]]},{q,0,c[[2]]},{r,0,c[[3]]},{s,0,c[[4]]}]];list=Union[Select[Flatten[list[[2]]],#<=2m&]];list=list+4m;Print[Length[list]];Print[Column[f[list]]];Abort[]]Thanking you in advancePaul.