I have to find the number of elements satisfying a given condition from the set:
Tuples[Tuples[Tuples[{0,1},n],n],m]
The condition for $n=3,m=3$ is:
h[{{{x1_, x2_, x3_}, {x4_, x5_, x6_}, {x7_, x8_, x9_}}, {{y1_, y2_,
y3_}, {y4_, y5_, y6_}, {y7_, y8_, y9_}}, {{z1_, z2_, z3_}, {z4_,
z5_, z6_}, {z7_, z8_, z9_}}}]=1
where,
h[{{{x1_, x2_, x3_}, {x4_, x5_, x6_}, {x7_, x8_, x9_}}, {{y1_, y2_,
y3_}, {y4_, y5_, y6_}, {y7_, y8_, y9_}}, {{z1_, z2_, z3_}, {z4_,
z5_, z6_}, {z7_, z8_, z9_}}}] = Piecewise[{{1,
f[x1 + y1 + z1] + f[x4 + y4 + z4] + f[x7 + y7 + z7] !=
f[x2 + y2 + z2] + f[x5 + y5 + z5] + f[x8 + y8 + z8] &&
f[x2 + y2 + z2] + f[x5 + y5 + z5] + f[x8 + y8 + z8] !=
f[x3 + y3 + z3] + f[x6 + y6 + z6] + f[x9 + y9 + z9] &&
f[x1 + y1 + z1] + f[x4 + y4 + z4] + f[x7 + y7 + z7] !=
f[x3 + y3 + z3] + f[x6 + y6 + z6] + f[x9 + y9 + z9]}}, 0]
I don't have to output which ones satisfy the condition - I just need to count them. Currently, I generate the whole set and use the $Select$ function (together with $Length$). However, for $n=4,m=5$ this is already too large for Mathematica to run.
I am thinking there must be a (slow, but memory efficient) way to construct $Tuples[Tuples[Tuples[{0,1},n],n],m]$ one element at a time and check for each element whether it satisfies the condition or not.
I am mostly interested in $n<=5$ and $m<=5$.
Thank you in advance!
((2^n)^n)^m
is enormous for n=m=5 $\endgroup$Count[]
suffice? $\endgroup$