login
A341682
Successive approximations up to 5^n for the 5-adic integer Sum_{k>=0} k!.
5
0, 4, 14, 64, 314, 2814, 2814, 2814, 237189, 1018439, 1018439, 10784064, 10784064, 743205939, 1963909064, 20274455939, 142344768439, 142344768439, 142344768439, 7771739299689, 64992198284064, 446461924846564, 1876973399455939, 4261159190471564, 16182088145549689, 16182088145549689
OFFSET
0,2
COMMENTS
a(n) == Sum_{k>=0} k! (mod 5^n). Since k! mod 5^n is eventually zero, a(n) is well-defined.
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)!
LINKS
FORMULA
For n > 0, a(n) = (Sum_{k=0..m} k!) mod 5^n, where m = 4*(n + floor(log_5(4*n))).
EXAMPLE
For n = 7, since 5^7 divides 30!, we have a(7) = (Sum_{k=0..29} k!) mod 5^7 = 2814.
For n = 29, since 5^29 divides 125!, we have a(29) = (Sum_{k=0..124} k!) mod 5^29 = 173465698384532268439.
PROG
(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))))
CROSSREFS
Cf. A341686 (digits of Sum_{k>=0} k!).
Successive approximations for the p-adic integer Sum_{k>=0} k!: A341680 (p=2), A341681 (p=3), this sequence (p=5), A341683 (p=7).
Cf. A007845 (least positive integer k for which 2^n divides k!).
Sequence in context: A149495 A137956 A357793 * A242764 A356004 A154407
KEYWORD
nonn
AUTHOR
Jianing Song, Feb 17 2021
STATUS
approved