The correct permutation cycle for the Verkhoev algorithm

I am implementing the Verhoeff algorithm for a check digit scheme, but there seem to be some disagreement in network sources regarding which permutation loop should form the basis of the permutation table.

Wikipedia uses: (36) (01589427)

while obviously , Numerical Recipies uses a different loop and this book uses: (0) (14) (23) (56789), cited in a 1990 article by Winters. He also notes that Verhoff used one quote from Wikipedia.

Now my number theory is a little rusty, but the Wikipedia cycle will clearly repeat after the 8th degree, while the book alone will take 10, despite the fact that it says s ^ 8 = s. There are other errors in 2-cycles in table 2.14 (b), so this is still doubtful.

Unfortunately, I do not have copies of the original articles (and I am too tight to pay / refuse that 40-year-old knowledge is still held for redemption by publishers), as well as a copy of Numericical Recipes for verification (and am loath to install them connected to paranoid copy protection module for viewing on the Internet).

Does anyone know what is right? Are they right?

+4
source share
2 answers

There is an old edition of Numerical Recipes here in PDF format. The Verhoff algorithm is described in section 20.3. It uses the same permutation as the Wikipedia article.

+2
source

The permutation (0) (14) (23) (56789) is better than the permutation (36) (01589427). This is due to the fact that (36) (01589427) can detect only 88.89% of single transposition errors, and (0) (14) (23) (56789) can detect all of them. Consider that the numeric code 716 is set to 0 as a check digit if (36) (01589427) is used. that is, the code will be 7160. But, if the numbers 1 and 6 are transposed, this check digit scheme does not give an error, since the checksum is zero. This does not apply to (0) (14) (23) (56789).

+1
source

Source: https://habr.com/ru/post/1310354/


All Articles