isOdd = logical(rem(N,2)); isEven = ~logical(rem(N,2));