Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Talk:Luhn mod N algorithm

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 7 years ago by Stevie-O in topic Problems if N is odd

Problems if N is odd

[edit]

While implementing this algorithm, I noticed an interesting property for odd N:

Consider the case of base-9. For doubled positions, this occurs:

Original digitDoubledReduced
00 (009)0
12 (029)2
24 (049)4
36 (069)6
48 (089)8
510 (119)2
612 (139)4
714 (159)6
816 (179)8

This means that, for base-9, e.g. both '1' and '5' in doubled positions are equivalent. This has the following consequences for odd N:

  • The algorithm cannot detect all single-digit errors; "17" and "57" both have valid check digits for _sum_ ≡ 0 (mod 9)
  • If it is necessary to have the computed value be in a "doubled" position, it is not be possible to obtain the required modulo sum for all input cases.

Stevie-O (talk) 13:48, 30 May 2019 (UTC)Reply