OFFSET
2,1
COMMENTS
These primes are natural choices for the modulus in a two-digit check digit system in base n, because the check digits are computed modulo p and range from 0 to n^2-1 (i.e., they fit in two base-n digits). The condition that n is a primitive root modulo p ensures that the multiplicative order of n modulo p is maximal (equal to p-1). This maximal order allows the check digit algorithm to detect a wide variety of errors (such as single-digit errors, transpositions, and cyclic shifts) for data strings of length up to p-1 digits. For n = 10, a(10) = 97, and the fact that 10 is a primitive root modulo 97 is exactly what underlies the ISO 7064 MOD 97-10 standard (used e.g. for IBAN numbers), which can handle strings of up to 96 digits.
MATHEMATICA
Table[If[IntegerQ[Sqrt[b]], 0,
Prime[NestWhile[# - 1 &, PrimePi[b^2],
MultiplicativeOrder[b, Prime[#]] < Prime[#] - 1 &]]], {b, 2, 54}]
PROG
(PARI) row(n) = my(p=prime(n), r=vector(eulerphi(p-1)), pr=znprimroot(p), j=0); for(i=1, p-1, if(gcd(i, p-1)==1, r[j++]=lift(pr^i))); vecsort(r); \\ A060749
a(n) = if (issquare(n), 0, my(p=precprime(n^2), ip = primepi(p)); while (!vecsearch(row(ip), n), ip--); prime(ip)); \\ Michel Marcus, Mar 17 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Steven Lu, Mar 17 2026
STATUS
approved
