<s>
The	O
Verhoeff	B-Error_Name
algorithm	I-Error_Name
is	O
a	O
checksum	B-Algorithm
for	O
error	B-Error_Name
detection	I-Error_Name
first	O
published	O
by	O
Dutch	O
mathematician	O
Jacobus	O
Verhoeff	O
in	O
1969	O
.	O
</s>
<s>
It	O
was	O
the	O
first	O
decimal	O
check	B-Error_Name
digit	I-Error_Name
algorithm	O
which	O
detects	O
all	O
single-digit	O
errors	O
,	O
and	O
all	O
transposition	O
errors	O
involving	O
two	O
adjacent	O
digits	O
,	O
which	O
was	O
at	O
the	O
time	O
thought	O
impossible	O
with	O
such	O
a	O
code	O
.	O
</s>
<s>
Verhoeff	O
had	O
the	O
goal	O
of	O
finding	O
a	O
decimal	O
code	O
—	O
one	O
where	O
the	O
check	B-Error_Name
digit	I-Error_Name
is	O
a	O
single	O
decimal	O
digit	O
—	O
which	O
detected	O
all	O
single-digit	O
errors	O
and	O
all	O
transpositions	O
of	O
adjacent	O
digits	O
.	O
</s>
<s>
At	O
the	O
time	O
,	O
supposed	O
proofs	O
of	O
the	O
nonexistence	O
of	O
these	O
codes	O
made	O
base-11	O
codes	O
popular	O
,	O
for	O
example	O
in	O
the	O
ISBN	O
check	B-Error_Name
digit	I-Error_Name
.	O
</s>
<s>
The	O
general	O
idea	O
of	O
the	O
algorithm	O
is	O
to	O
represent	O
each	O
of	O
the	O
digits	O
(	O
0	O
through	O
9	O
)	O
as	O
elements	O
of	O
the	O
dihedral	B-Algorithm
group	I-Algorithm
.	O
</s>
<s>
For	O
example	O
the	O
check	B-Error_Name
digit	I-Error_Name
for	O
248	O
is	O
5	O
.	O
</s>
<s>
In	O
practice	O
the	O
algorithm	O
is	O
implemented	O
using	O
simple	O
lookup	B-Data_Structure
tables	I-Data_Structure
without	O
needing	O
to	O
understand	O
how	O
to	O
generate	O
those	O
tables	O
from	O
the	O
underlying	O
group	O
and	O
permutation	B-Algorithm
theory	O
.	O
</s>
<s>
This	O
is	O
more	O
properly	O
considered	O
a	O
family	O
of	O
algorithms	O
,	O
as	O
other	O
permutations	B-Algorithm
work	O
too	O
.	O
</s>
<s>
Verhoeff	O
's	O
notes	O
that	O
the	O
particular	O
permutation	B-Algorithm
,	O
given	O
above	O
,	O
is	O
special	O
as	O
it	O
has	O
the	O
property	O
of	O
detecting	O
95.3	O
%	O
of	O
the	O
phonetic	O
errors	O
.	O
</s>
<s>
The	O
main	O
weakness	O
of	O
the	O
Verhoeff	B-Error_Name
algorithm	I-Error_Name
is	O
its	O
complexity	O
.	O
</s>
<s>
Lookup	B-Data_Structure
tables	I-Data_Structure
are	O
required	O
for	O
easy	O
calculation	O
.	O
</s>
<s>
The	O
Verhoeff	B-Error_Name
algorithm	I-Error_Name
can	O
be	O
implemented	O
using	O
three	O
tables	O
:	O
</s>
<s>
a	O
multiplication	O
table	O
d	O
,	O
an	O
inverse	O
table	O
inv	O
,	O
and	O
a	O
permutation	B-Algorithm
table	O
p	O
.	O
</s>
<s>
The	O
first	O
table	O
,	O
d	O
,	O
is	O
based	O
on	O
multiplication	O
in	O
the	O
dihedral	B-Algorithm
group	I-Algorithm
D5	I-Algorithm
.	O
</s>
<s>
The	O
permutation	B-Algorithm
table	O
p	O
applies	O
a	O
permutation	B-Algorithm
to	O
each	O
digit	O
based	O
on	O
its	O
position	O
in	O
the	O
number	O
.	O
</s>
<s>
This	O
is	O
actually	O
a	O
single	O
permutation	B-Algorithm
applied	O
iteratively	O
;	O
i.e.	O
</s>
<s>
The	O
Verhoeff	O
checksum	B-Algorithm
calculation	O
is	O
performed	O
as	O
follows	O
:	O
</s>
<s>
Initialize	O
the	O
checksum	B-Algorithm
c	O
to	O
zero	O
.	O
</s>
<s>
To	O
generate	O
a	O
check	B-Error_Name
digit	I-Error_Name
,	O
append	O
a	O
,	O
perform	O
the	O
calculation	O
:	O
the	O
correct	O
check	B-Error_Name
digit	I-Error_Name
is	O
.	O
</s>
<s>
Generate	O
a	O
check	B-Error_Name
digit	I-Error_Name
for	O
236	O
:	O
</s>
<s>
c	O
is	O
2	O
,	O
so	O
the	O
check	B-Error_Name
digit	I-Error_Name
is	O
inv(2 )	O
,	O
which	O
is	O
3	O
.	O
</s>
<s>
Validate	O
the	O
check	B-Error_Name
digit	I-Error_Name
2363	O
:	O
</s>
