%% All Permutations of Unsigned Integers

v = uint16([1023 4095 65535]);
P = perms(v)

% Copyright 2012 The MathWorks, Inc.