From: "Jan Simon" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Derangement: efficient full permutation
Date: Tue, 1 Feb 2011 13:23:03 +0000 (UTC)
Organization: Universit&#228;t Heidelberg
Lines: 8
Message-ID: <ii91fn$5eo$>
References: <ii8ut8$3fb$> <ii90lg$qmd$>
Reply-To: "Jan Simon" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1296566583 5592 (1 Feb 2011 13:23:03 GMT)
NNTP-Posting-Date: Tue, 1 Feb 2011 13:23:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869888
Xref: comp.soft-sys.matlab:707420

Dear Bruno,

> Your algorithm surely has BUG, e.g., n = 1 it generate a derangement 1, which is impossible.

Yup. I've posted a reduced version only. In the full version I reject N=1 and reply [2,1] for N=2.
Do you see limitations for N>=3  --- except for the necessary warnings for e.g. N > 2^48 or complex N?

Kind regards, Jan