OFFSET
4,1
COMMENTS
Given a number M, remove its last digit d, then subtract d*a(n). If the result is divisible by prime(n), then M is also divisible by prime(n). This process may be repeated.
Values of a(n) can be quickly calculated by finding the smallest multiple of prime(n) which ends in a 1, and removing this last digit. E.g., 7 -> 21 -> 2, 11 -> 11 -> 1, 13 -> 91 -> 9, 17 -> 51 -> 5, 19 -> 171 -> 17.
a(n) is the canonical representative, in the interval (0, p), of the inverse of -10, modulo p = prime(n). - M. F. Hasler, Feb 03 2025
REFERENCES
Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, page 76-81.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 4..20000
FORMULA
a(n) = p - (10 mod p)^(-1) where p = prime(n). - Joerg Arndt, Jan 23 2023
MAPLE
a:= n-> -1/10 mod ithprime(n):
seq(a(n), n=4..69); # Alois P. Heinz, Feb 03 2025
MATHEMATICA
a[n_] := Block[{p = Prime[n], k = 1}, While[ Mod[10k + 1, p] != 0, k++ ]; k]; Table[ a[n], {n, 4, 69}]
PowerMod[-10, -1, Prime[Range[4, 100]]] (* Paolo Xausa, Feb 06 2025 *)
PROG
(Python)
import sympy
[pow(-10, -1, p) for p in sympy.primerange(7, 300)]
# Nicholas Stefan Georgescu, Jan 17 2023
(PARI) vector(66, n, my(p=prime(n+3)); p-lift(Mod(10, p)^-1)) \\ Joerg Arndt, Jan 23 2023
(PARI) a(n)=lift(-1/Mod(10, prime(n)));
apply(a, [4..66]) \\ M. F. Hasler, Feb 03 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Alfred S. Posamentier (asp2(AT)juno.com) and Robert G. Wilson v, Feb 10 2005
EXTENSIONS
Definition edited by M. F. Hasler, Feb 03 2025
STATUS
approved
