%I #10 Feb 19 2021 03:38:30
%S 0,4,14,64,314,2814,2814,2814,237189,1018439,1018439,10784064,
%T 10784064,743205939,1963909064,20274455939,142344768439,142344768439,
%U 142344768439,7771739299689,64992198284064,446461924846564,1876973399455939,4261159190471564,16182088145549689,16182088145549689
%N Successive approximations up to 5^n for the 5-adic integer Sum_{k>=0} k!.
%C a(n) == Sum_{k>=0} k! (mod 5^n). Since k! mod 5^n is eventually zero, a(n) is well-defined.
%C In general, for every prime p, the p-adic integer x = Sum_{k>=0} k! is well-defined. To find the approximation up to p^n (n > 0) for x, it is enough to add k! for 0 <= k <= m and then find the remainder of the sum modulo p^n, where m = (p - 1)*(n + floor(log_p((p-1)*n))). This is because p^n divides (m+1)!
%H Jianing Song, <a href="/A341682/b341682.txt">Table of n, a(n) for n = 0..1000</a>
%F For n > 0, a(n) = (Sum_{k=0..m} k!) mod 5^n, where m = 4*(n + floor(log_5(4*n))).
%e For n = 7, since 5^7 divides 30!, we have a(7) = (Sum_{k=0..29} k!) mod 5^7 = 2814.
%e For n = 29, since 5^29 divides 125!, we have a(29) = (Sum_{k=0..124} k!) mod 5^29 = 173465698384532268439.
%o (PARI) a(n) = my(p=5); if(n==0, 0, lift(sum(k=0, (p-1)*(n+logint((p-1)*n, p)), Mod(k!, p^n))))
%Y Cf. A341686 (digits of Sum_{k>=0} k!).
%Y Successive approximations for the p-adic integer Sum_{k>=0} k!: A341680 (p=2), A341681 (p=3), this sequence (p=5), A341683 (p=7).
%Y Cf. A007845 (least positive integer k for which 2^n divides k!).
%K nonn
%O 0,2
%A _Jianing Song_, Feb 17 2021