login
n! less trailing zeros (A004154) (mod nextprime(n)).
1

%I #12 Nov 14 2024 08:56:18

%S 1,1,2,1,4,5,2,9,6,10,10,3,10,7,13,11,6,8,11,15,7,9,14,13,22,20,27,4,

%T 25,16,17,7,2,29,24,10,27,3,32,18,31,21,22,15,2,9,38,26,29,43,48,10,

%U 43,55,20,51,24,11,48,2,12,57,50,1,64,14,53,8,47

%N n! less trailing zeros (A004154) (mod nextprime(n)).

%F a(n) = A004154(n) mod A151800(n).

%t 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]

%o (Python)

%o from functools import reduce

%o from sympy import nextprime

%o from sympy.ntheory.factor_ import digits

%o 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

%Y Cf. A004154, A151800.

%K easy,base,nonn

%O 0,3

%A _Robert G. Wilson v_, Sep 18 2024