Date: Mar 26, 2013 4:05 AM
Author: Iván Lazaro
Subject: Insufficient memory "General::nomem:" using Tuples

Hi all!

I've encounter a weird behavior today using Mathematica 9 under Linux.

I'm defining a list of available modes

num = 15;
maxModes = ConstantArray[2, num];

and then trying to organize them in all possible tuples

lst=Tuples[Range[0, #] & /@ Join[maxModes - 1, maxModes - 1]];

I expect a BIG number of outcomes, but then I'm just removing some
(almost all) of them from the list:

lst1=DeleteCases[Map[If[Total@Take[#, num] != Total@Take[#, {num + 1, 2 num}],
sym, #] &,lst], _Symbol];

The problem is that the computation doesn't finish building the
tuples. I'm getting the output "General::nomem: The current
computation was aborted because there was insufficient memory
available to complete the computation."

Is there a way to avoid this?

Thanks in advance!