This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A385301 #32 Jul 01 2025 02:54:40 %S A385301 0,1,0,3,6,0,8,4,4,9,21,0,39,37,40,32,26,12,61,6,57,74,21,41,39,60,86, %T A385301 64,4,27,55,2,63,113,29,42,150,97,33,84,100,120,184,72,1,134,100,78, %U A385301 145,8,199,98,65,25,104,95,153,207,90,132,67,132,301,251,293,185,168,176,120,297 %N A385301 a(n) = Sum_{k=0..p-1} 1/k! mod p where p is prime(n) and 1/k! is the inverse of k! modulo p. %H A385301 Robert Israel, <a href="/A385301/b385301.txt">Table of n, a(n) for n = 1..2585</a> %F A385301 a(n) = Sum_{k=0..prime(n) - 1} (k!)^(prime(n) - 2) mod prime(n) where prime(n) is the n-th prime. %F A385301 a(n) = A153229(p) mod p, where p = prime(n). - _David Radcliffe_, Jun 26 2025 %e A385301 a(1) = Sum_(k=0..2 - 1) (k!)^(2 - 2) mod 2 = 0. %p A385301 f:= proc(n) local p,k; p:= ithprime(n); add(1/k!, k=1..p-1) mod p end proc: %p A385301 map(f, [$1..100]); # _Robert Israel_, Jul 01 2025 %t A385301 a[n_] := Module[{p = Prime[n]}, Mod[Sum[PowerMod[k!, p-2, p], {k, 0, p-1}], p]]; a[1] = 0; Array[a, 100] (* _Amiram Eldar_, Jun 26 2025 *) %o A385301 (PARI) a(n) = sum(k=0, prime(n) - 1, (k!)^(prime(n) - 2)) % prime(n); \\ _Michel Marcus_, Jun 25 2025 %o A385301 (Python) %o A385301 from sympy import prime %o A385301 def a(n): %o A385301 p = prime(n) %o A385301 s = invfact = 1 %o A385301 for i in range(1, p): %o A385301 invfact = (invfact * pow(i, -1, p)) % p %o A385301 s += invfact %o A385301 return s % p # _David Radcliffe_, Jun 25 2025 %Y A385301 Cf. A153229, A064384. %K A385301 nonn %O A385301 1,4 %A A385301 _Paras Dhanuka_, Jun 24 2025 %E A385301 More terms from _Michel Marcus_, Jun 25 2025