<s>
The	O
Luhn	B-Algorithm
mod	I-Algorithm
N	I-Algorithm
algorithm	I-Algorithm
is	O
an	O
extension	O
to	O
the	O
Luhn	B-Algorithm
algorithm	I-Algorithm
(	O
also	O
known	O
as	O
mod	B-Algorithm
10	I-Algorithm
algorithm	O
)	O
that	O
allows	O
it	O
to	O
work	O
with	O
sequences	O
of	O
values	O
in	O
any	O
even-numbered	O
base	O
.	O
</s>
<s>
The	O
Luhn	B-Algorithm
mod	I-Algorithm
N	I-Algorithm
algorithm	I-Algorithm
generates	O
a	O
check	O
digit	O
(	O
more	O
precisely	O
,	O
a	O
check	O
character	O
)	O
within	O
the	O
same	O
range	O
of	O
valid	O
characters	O
as	O
the	O
input	O
string	O
.	O
</s>
<s>
The	O
Luhn	B-Algorithm
mod	I-Algorithm
N	I-Algorithm
algorithm	I-Algorithm
only	O
works	O
where	O
is	O
divisible	O
by	O
2	O
.	O
</s>
<s>
For	O
applications	O
using	O
the	O
English	O
alphabet	O
this	O
is	O
not	O
a	O
problem	O
,	O
since	O
a	O
string	O
of	O
lower-case	O
letters	O
has	O
26	O
code-points	O
,	O
and	O
adding	O
Decimal	B-Application
characters	O
adds	O
a	O
further	O
10	O
,	O
maintaining	O
an	O
divisible	O
by	O
2	O
.	O
</s>
<s>
The	O
second	O
step	O
in	O
the	O
Luhn	B-Algorithm
algorithm	I-Algorithm
re-packs	O
the	O
doubled	O
value	O
of	O
a	O
position	O
into	O
the	O
original	O
digit	O
's	O
base	O
by	O
adding	O
together	O
the	O
individual	O
digits	O
in	O
the	O
doubled	O
value	O
when	O
written	O
in	O
base	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Decimal	B-Application
applications	O
where	O
is	O
10	O
,	O
original	O
values	O
between	O
0	O
and	O
4	O
result	O
in	O
even	O
numbers	O
and	O
original	O
values	O
between	O
5	O
and	O
9	O
result	O
in	O
odd	O
numbers	O
,	O
effectively	O
re-packing	O
the	O
doubled	O
values	O
between	O
0	O
and	O
18	O
into	O
a	O
single	O
distinct	O
result	O
between	O
0	O
and	O
9	O
.	O
</s>
<s>
The	O
Luhn	B-Algorithm
mod	I-Algorithm
N	I-Algorithm
algorithm	I-Algorithm
odd	O
variation	O
enables	O
applications	O
where	O
is	O
not	O
divisable	O
by	O
2	O
by	O
replacing	O
the	O
doubled	O
value	O
at	O
each	O
position	O
with	O
the	O
remainder	O
after	O
dividing	O
the	O
position	O
's	O
value	O
by	O
which	O
gives	O
odd	O
number	O
remainders	O
consistent	O
with	O
the	O
original	O
algorithm	O
design	O
.	O
</s>
<s>
The	O
simplest	O
approach	O
(	O
akin	O
to	O
the	O
original	O
Luhn	B-Algorithm
algorithm	I-Algorithm
)	O
is	O
to	O
use	O
ASCII	O
code	O
arithmetic	O
.	O
</s>
<s>
A	O
more	O
flexible	O
approach	O
is	O
to	O
use	O
something	O
similar	O
to	O
an	O
associative	B-Application
array	I-Application
.	O
</s>
