cp's OEIS Frontend

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.

User: Paras Dhanuka

Paras Dhanuka's wiki page.

Paras Dhanuka has authored 1 sequences.

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.

Original entry on oeis.org

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, 64, 4, 27, 55, 2, 63, 113, 29, 42, 150, 97, 33, 84, 100, 120, 184, 72, 1, 134, 100, 78, 145, 8, 199, 98, 65, 25, 104, 95, 153, 207, 90, 132, 67, 132, 301, 251, 293, 185, 168, 176, 120, 297
Offset: 1

Author

Paras Dhanuka, Jun 24 2025

Keywords

Examples

			a(1) = Sum_(k=0..2 - 1) (k!)^(2 - 2) mod 2 = 0.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p,k; p:= ithprime(n); add(1/k!, k=1..p-1) mod p end proc:
    map(f, [$1..100]); # Robert Israel, Jul 01 2025
  • Mathematica
    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 *)
  • PARI
    a(n) = sum(k=0, prime(n) - 1, (k!)^(prime(n) - 2)) % prime(n); \\ Michel Marcus, Jun 25 2025
    
  • Python
    from sympy import prime
    def a(n):
       p = prime(n)
       s = invfact = 1
       for i in range(1, p):
           invfact = (invfact * pow(i, -1, p)) % p
           s += invfact
       return s % p # David Radcliffe, Jun 25 2025

Formula

a(n) = Sum_{k=0..prime(n) - 1} (k!)^(prime(n) - 2) mod prime(n) where prime(n) is the n-th prime.
a(n) = A153229(p) mod p, where p = prime(n). - David Radcliffe, Jun 26 2025

Extensions

More terms from Michel Marcus, Jun 25 2025