login
A341680
Successive approximations up to 2^n for the 2-adic integer Sum_{k>=0} k!.
5
0, 0, 2, 2, 10, 26, 26, 26, 26, 26, 538, 538, 2586, 6682, 14874, 31258, 64026, 129562, 129562, 391706, 915994, 1964570, 4061722, 8256026, 8256026, 8256026, 8256026, 8256026, 142473754, 410909210, 947780122, 2021521946, 4169005594, 8463972890, 8463972890, 25643842074
OFFSET
0,3
COMMENTS
a(n) == Sum_{k>=0} k! (mod 2^n). Since k! mod 2^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 2^n, where m = n + floor(log_2(n))).
EXAMPLE
For n = 9, since 2^9 divides 12!, we have a(9) = (Sum_{k=0..11} k!) mod 2^9 = 26.
For n = 12, since 2^12 divides 16!, we have a(12) = (Sum_{k=0..15} k!) mod 2^12 = 2586.
PROG
(PARI) a(n) = my(p=2); if(n==0, 0, lift(sum(k=0, (p-1)*(n+logint((p-1)*n, p)), Mod(k!, p^n))))
CROSSREFS
Cf. A341684 (digits of Sum_{k>=0} k!).
Successive approximations for the p-adic integer Sum_{k>=0} k!: A341680 (this sequence), A341681 (p=3), A341682 (p=5), A341683 (p=7).
Cf. A007843 (least positive integer k for which 2^n divides k!).
Sequence in context: A230893 A151389 A151428 * A213338 A309753 A102345
KEYWORD
nonn
AUTHOR
Jianing Song, Feb 17 2021
STATUS
approved