OFFSET
1,4
COMMENTS
From Robert Israel, Jun 16 2025: (Start)
a(n) is the least number k such that (prime(n)-1) concatenated with k == 0 (mod prime(n)).
a(n) is the least k >= 0 such that k == 10^d (mod prime(n)) where k has d decimal digits. (End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(5) = 12, 10! concatenated with 12 = 362880012 == 0 (mod prime(5)).
MAPLE
c0:=proc(x, y) local s: s:=proc(m) nops(convert(m, base, 10)) end: if y=0 then 10*x else x*10^s(y)+y: fi end: a:=proc(n) local p: p:=proc(k) if c0((ithprime(n)-1)!, k) mod ithprime(n) = 0 then k else fi end: [seq(p(k), k=0..400)][1] end: seq(a(n), n=1..75); # c0 yields the concatenation of two numbers # Emeric Deutsch, Aug 05 2005
# Alternative:
f:= proc(p) local d, k, j;
for d from 1 + ilog10(p) do;
k:= 10^d mod p;
if k < 10^(d-1) then j:= ceil((10^(d-1)-k)/p); k:= k + j*p fi;
if k < 10^d then return k fi;
od;
end proc;
f(2):= 0: f(5):= 0:
map(f @ ithprime, [$1..100]); # Robert Israel, Jun 16 2025
MATHEMATICA
Do[p = Prime[n]; k = 0; s = ToString[(p-1)! ]; While[Mod[ToExpression[s <> ToString[k]], p] > 0, k++ ]; Print[k], {n, 1, 50}] (* Ryan Propper, Aug 05 2005 *)
lnk[n_]:=Module[{p=Prime[n], c, k=0}, c=(Prime[n]-1)!; While[Mod[ c*10^ IntegerLength[ k]+k, p]!=0, k++]; k]; Join[{0, 1, 0}, Array[lnk, 60, 4]] (* Harvey P. Dale, Dec 27 2019 *)
CROSSREFS
KEYWORD
AUTHOR
Amarnath Murthy, Aug 01 2005
EXTENSIONS
More terms from Ryan Propper and Emeric Deutsch, Aug 05 2005
STATUS
approved
