cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A374967 a(n) is the Verhoeff check digit for n.

This page as a plain text file.
%I A374967 #52 Apr 08 2025 23:29:27
%S A374967 0,5,7,6,3,8,2,0,9,1,9,3,1,2,5,0,6,8,4,7,4,5,7,6,3,8,2,0,9,1,1,7,9,8,
%T A374967 0,5,4,2,6,3,8,2,0,1,9,4,5,7,3,6,5,4,2,3,6,1,7,9,0,8,7,1,4,0,8,3,9,6,
%U A374967 2,5,3,9,6,5,2,7,1,4,8,0,0,6,8,7,4,9,3,1
%N A374967 a(n) is the Verhoeff check digit for n.
%C A374967 The Verhoeff checksum is a single-digit error-detecting code.
%H A374967 J. Verhoeff, <a href="https://ir.cwi.nl/pub/13046/">Error Detecting Decimal Codes</a> Mathematical Centre Tracts, 29.
%H A374967 Wikipedia, <a href="https://en.wikipedia.org/wiki/Dihedral_group">Dihedral group</a>.
%H A374967 Wikipedia, <a href="https://en.wikipedia.org/wiki/Verhoeff_algorithm">Verhoeff algorithm</a>.
%o A374967 (Python)
%o A374967 d_table = [
%o A374967     [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],[1, 2, 3, 4, 0, 6, 7, 8, 9, 5],
%o A374967     [2, 3, 4, 0, 1, 7, 8, 9, 5, 6],[3, 4, 0, 1, 2, 8, 9, 5, 6, 7],
%o A374967     [4, 0, 1, 2, 3, 9, 5, 6, 7, 8],[5, 9, 8, 7, 6, 0, 4, 3, 2, 1],
%o A374967     [6, 5, 9, 8, 7, 1, 0, 4, 3, 2],[7, 6, 5, 9, 8, 2, 1, 0, 4, 3],
%o A374967     [8, 7, 6, 5, 9, 3, 2, 1, 0, 4],[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
%o A374967 ]
%o A374967 p_table = [
%o A374967     [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],[1, 5, 7, 6, 2, 8, 3, 0, 9, 4],
%o A374967     [5, 8, 0, 3, 7, 9, 6, 1, 4, 2],[8, 9, 1, 6, 0, 4, 3, 5, 2, 7],
%o A374967     [9, 4, 5, 3, 1, 2, 6, 8, 7, 0],[4, 2, 8, 6, 5, 7, 3, 9, 0, 1],
%o A374967     [2, 7, 9, 3, 8, 0, 6, 4, 1, 5],[7, 0, 4, 6, 9, 1, 3, 2, 5, 8]
%o A374967 ]
%o A374967 j_table = [0, 4, 3, 2, 1, 5, 6, 7, 8, 9]
%o A374967 def a(n):
%o A374967     c, ds = 0, list(map(int, str(n*10)[::-1]))
%o A374967     for i, d in enumerate(ds):
%o A374967         c = d_table[c][p_table[i % 8][d]]
%o A374967     return j_table[c]
%o A374967 print([a(n) for n in range(0, 55)])
%Y A374967 Cf. A093018.
%K A374967 nonn,easy,base
%O A374967 0,2
%A A374967 _DarĂ­o Clavijo_, Jul 25 2024