Generate permutations of 1:n and permutation parity.
Updated 23 Feb 2021

View License

For positive integer n, [p,s] = permn(n) returns all permutations of 1:n as a matrix, size-[factorial(n),n], and also returns the permutation parity s, size-[factorial(n),1]. s(j) is +1 for an even permutation p(j,:), and -1 for an odd permutation.

Cite As

Kenneth Johnson (2024). permn (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Inspired by: permutationparity

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes