OFFSET
0,3
MATHEMATICA
a[n_] := Mod[n!/10^IntegerExponent[n!, 10], NextPrime[n]]; Array[a, 69, 0](* Becomes quicker as n increases and it uses less resources. For me, this is around 2 million *)g[n_, p_] := Block[{s = 0, e = 1}, While[t = Floor[n/p^e]; t > 0, s += t; e++]; s]; f[n_] := Block[{m = NextPrime@ n, p = 1, q = 7}, p = PowerMod[2, g[n, 2] - g[n, 5], m]; p = Mod[p*PowerMod[3, g[n, 3], m], m]; While[q < n +1, p = Mod[p*PowerMod[q, g[n, q], m], m]; q = NextPrime@ q]; p]
PROG
(Python)
from functools import reduce
from sympy import nextprime
from sympy.ntheory.factor_ import digits
def A376286(n): return ((p:=nextprime(n))-1)*pow(reduce(lambda i, j:i*j%p, range(n+1, p), 1), -1, p)*pow(10, sum(digits(n, 5)[1:])-n>>2, p)%p # Chai Wah Wu, Oct 18 2024
CROSSREFS
KEYWORD
easy,base,nonn,changed
AUTHOR
Robert G. Wilson v, Sep 18 2024
STATUS
approved