As answered by Nick, what you wrote is interpreted by MATLAB as
2:2:10
i.e., the 3
of the first nested sequence is ignored.
What I think you wanted to accomplish was a union
of two separate sequences:
>> union(2:2:10, 3:3:10)
ans =
2 3 4 6 8 9 10
More generally,
N = 100;
C = arrayfun(@(x)x+x:x:N, 2:N, 'UniformOutput', false);
unique([C{:}])