Verhoeff 算法的正确排列周期

发布于 2024-09-01 22:16:30 字数 728 浏览 3 评论 0原文

我正在为校验位方案实现 Verhoeff 算法,但对于哪个排列周期应构成排列表的基础,网络资源中似乎存在一些分歧。

维基百科使用:(36)(01589427)

显然,Numerical Recipies 使用不同的周期,并且本书使用:(0)(14)(23)(56789),引用自1990 年温特斯的文章。它还指出,韦尔霍夫使用了维基百科的一句话。

现在,我的数论有点生疏了,但维基百科的循环显然会在 8 次方之后重复,而一本书会取 10,尽管它说 s^8=s。表 2.14(b) 在 2 个周期中还有其他错误,因此无论如何这是值得怀疑的。

不幸的是,我没有原始文章的副本(而且我太紧了,无法支付/厌恶 40 年前的知识仍然被出版商勒索赎金),也没有《数字食谱》的副本可供检查(并且我不愿意安装他们的偏执引起的复制保护插件以在线查看)。

那么有人知道哪一个是正确的吗?他们都正确吗?

I'm implementing the Verhoeff algorithm for a check digit scheme, but there seems to be some disagreement in web sources as to which permutation cycle should form the basis of the permutation table.

Wikipedia uses: (36)(01589427)

while apparently, Numerical Recipies uses a different cycle and this book uses: (0)(14)(23)(56789), quoted from a 1990 article by Winters. It also notes that Verhoeff used the one Wikipedia quotes.

Now, my number theory is a little rusty, but the Wikipedia cycle clearly will repeat after the 8th power, while the book one will take 10, despite it saying that s^8=s. Table 2.14(b) has other errors in the 2-cycles, so this is dubious anyway.

Unfortunately, I don't have copies of the original articles (and am too tight to pay/disgusted that 40-year old knowledge is still being held to ransom by publishers), nor a copy of Numerical Recipes to check (and am loath to install their paranoia-induced copy protection plug-in to view online).

So does any one know which is correct? Are they both correct?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ヤ经典坏疍 2024-09-08 22:16:30

此处提供 PDF 版本的旧版《数值食谱》。 Verhoeff 算法在 20.3 节中描述。它使用与维基百科文章相同的排列。

There's an old edition of Numerical Recipes available here as PDFs. Verhoeff algorithm is described in section 20.3. It uses the same permutation as the Wikipedia article.

风吹雨成花 2024-09-08 22:16:30

排列 (0)(14)(23)(56789) 优于排列 (36)(01589427)。这是因为,(36)(01589427)只能检测到88.89%的单次换位错误,而(0)(14)(23)(56789)可以检测到全部。如果使用 (36)(01589427),则考虑将数字代码 716 指定为 0 作为校验位。即,代码将为 7160。但是,如果数字 1 和 6 互换,则该校验位方案不会给出错误,因为校验和为零。 (0)(14)(23)(56789) 的情况并非如此。

The permutation (0)(14)(23)(56789) is better than the permutation (36)(01589427). This is because, (36)(01589427) can only detect 88.89% of the single transposition errors while (0)(14)(23)(56789) can detect all of them. Consider the numeric code 716 be given 0 as the check digit if (36)(01589427) is used. i.e., the code will be 7160. But, if the digits 1 and 6 are transposed, this check digit scheme does not give an error as the check sum is zero. This is not the case with (0)(14)(23)(56789).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文