% binary - return array contain binary sequece over N columns
%
% binary :: M:natural, N:natural -> [[M^N,N]->1..M].

function B=nary(M,N)

if (N==1), B=(1:M)';
else
	b=nary(M,N-1);
	m=size(b,1);
	B=[ kron((1:M)',ones(m,1)), repmat(b,M,1)];
end
