Keito, Claudio's solution works well and gives you detailed control over the form of the output. There is a built in command for doing combinations like this that is worth knowing about (although Claudio's approach is more general):
Tuples[{{2}, {5}, Range[6], Range[6]}] (* give all combinations taking one item from each list *)
gives
{{2,5,1,1},{2,5,1,2},{2,5,1,3},{2,5,1,4},{2,5,1,5},{2,5,1,6},{2,5,2,1},{2,5,2,2},{2,5,2,3},{2,5,2,4},{2,5,2,5},{2,5,2,6},{2,5,3,1},{2,5,3,2},{2,5,3,3},{2,5,3,4},{2,5,3,5},{2,5,3,6},{2,5,4,1},{2,5,4,2},{2,5,4,3},{2,5,4,4},{2,5,4,5},{2,5,4,6},{2,5,5,1},{2,5,5,2},{2,5,5,3},{2,5,5,4},{2,5,5,5},{2,5,5,6},{2,5,6,1},{2,5,6,2},{2,5,6,3},{2,5,6,4},{2,5,6,5},{2,5,6,6}}
Or you could separately prepend the {2,5} and generate just the combinations of the last two items with:
Tuples[Range[6],2] (* give all combinations of 2 items from the list *)
Regards, Neil
|