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.

Showing 1-4 of 4 results.

A002068 Wilson remainders: a(n) = ((p-1)!+1)/p mod p, where p = prime(n).

Original entry on oeis.org

1, 1, 0, 5, 1, 0, 5, 2, 8, 18, 19, 7, 16, 13, 6, 34, 27, 56, 12, 69, 11, 73, 20, 70, 70, 72, 57, 1, 30, 95, 71, 119, 56, 67, 94, 86, 151, 108, 21, 106, 48, 72, 159, 35, 147, 118, 173, 180, 113, 131, 169, 107, 196, 214, 177, 73, 121, 170, 25, 277, 164, 231, 271, 259, 288, 110
Offset: 1

Views

Author

Keywords

Comments

If this is zero, p is a Wilson prime (see A007540).
Costa, Gerbicz, & Harvey give an efficient algorithm for computing terms of this sequence. - Charles R Greathouse IV, Nov 09 2012

References

  • R. Crandall and C. Pomerance, Prime Numbers: A Computational Perspective, Springer, NY, 2001; see p. 29.
  • J. Roberts, Lure of the Integers, Math. Assoc. America, 1992, p. 244.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    f:= p -> ((p-1)!+1 mod p^2)/p;
    seq(f(ithprime(i)),i=1..1000); # Robert Israel, Jun 15 2014
  • Mathematica
    Table[p=Prime[n]; Mod[((p-1)!+1)/p, p], {n,100}] (* T. D. Noe, Mar 21 2006 *)
    Mod[((#-1)!+1)/#,#]&/@Prime[Range[70]] (* Harvey P. Dale, Feb 21 2020 *)
  • PARI
    forprime(n=2, 10^2, m=(((n-1)!+1)/n)%n; print1(m, ", ")) \\ Felix Fröhlich, Jun 14 2014

Formula

a(n) = A007619(n) mod A000040(n).
a(n) + A197631(n) = A275741(n) for n > 1. - Jonathan Sondow, Jul 08 2019
a(n) = ( A027641(p-1)/A027642(p-1) + 1/p - 1 ) mod p, where p = prime(n), proved by Glashier (1900). - Max Alekseyev, Jun 20 2020

A197632 Lerch primes: odd primes that divide their Lerch quotients A197630.

Original entry on oeis.org

3, 103, 839, 2237
Offset: 1

Views

Author

Jonathan Sondow, Oct 16 2011

Keywords

Comments

Odd primes p such that Sum_{a=1..p-1} a^(p-1) - (p-1)! == p (mod p^3). (The congruence holds mod p^2 for any odd prime p; see Lerch (1905).)
Marek Wolf has computed that if a 5th Lerch prime p exists, then 4496113 < p < 18816869 or 18977773 < p < 32452867 or p > 32602373.
Can a number be simultaneously a Lerch prime and a Wilson prime A007540?
René Gy (see links) has shown that a number is simultaneously a Lerch prime and a Wilson prime if and only if it satisfies the congruence (p - 1)! + 1 == 0 (mod p^3). - John Blythe Dobson, Feb 23 2018
Named after the Czech mathematician Mathias Lerch (1860-1922). - Amiram Eldar, Jun 23 2021

Examples

			The 27th prime is 103, and A197631(27) = 0, so 103 is a member.
		

Crossrefs

Programs

  • Mathematica
    Cases[Prime[Range[2, 500]], p_ /; Divisible[(Sum[(k^(p-1)-1)/p, {k, 1, p-1}] - ((p-1)! + 1)/p)/p, p]] (* Jean-François Alcover, Nov 21 2018 *)
  • PARI
    is(p)=my(m=p-1,P=p^3); !sum(k=1, m, Mod(k,P)^m,-p-m!) && isprime(p) \\ Charles R Greathouse IV, Jun 18 2012

Formula

A197630(A000720(a(n))) == 0 (mod a(n)).
A197631(A000720(a(n))) = 0.

A197630 Lerch quotients of odd primes: ((Sum_{k=1..p-1} q_p(k)) - w_p)/p, where q_p(k) = (k^(p-1)-1)/p is a Fermat quotient, w_p = ((p-1)!+1)/p is a Wilson quotient, and p is the n-th prime, with n > 1.

Original entry on oeis.org

0, 13, 1356, 123229034, 79417031713, 97237045496594199, 166710337513971577670, 993090310179794898808058068, 60995221345838813484944512721637147449, 332049278209768881045237587717723153006704, 120846039713576242385812868532189241842793944235993733
Offset: 2

Views

Author

Jonathan Sondow, Oct 16 2011

Keywords

Comments

Lerch proved that the Lerch quotient of any odd prime is an integer.
Is 13 the only Lerch quotient that is itself prime?
No other primes below 300,000 digits. - Charles R Greathouse IV, Nov 16 2011
Proof that a(n) is an integer for n >= 2: Note that ((p-1)!)^(p-1) = Product_{i=1..p-1} (1+i^(p-1)-1) == 1+Sum_{i=1..p-1} (i^(p-1)-1) (mod p^2). Write (p-1)! = kp-1, then ((p-1)!)^(p-1) == 1-(p-1)*kp == kp+1 == (p-1)!+2 (mod p^2). This gives Sum_{i=1..p-1} (i^(p-1)-1) == (p-1)!+1 (mod p^2), or Sum_{i=1..p-1} (i^(p-1)-1)/p == ((p-1)!+1)/p (mod p). - Jianing Song, Oct 15 2019

Examples

			a(3) = 13 because the 3rd prime is 5 and ((Sum_{k=1..4} q_5(k)) - w_5)/5 = (0 + 3 + 16 + 51 - 5)/5 = 13.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = Prime[n]}, (Sum[(k^(p - 1) - 1)/p, {k, p - 1}] - ((p - 1)! + 1)/p)/p]; Array[f, 12, 2] (* Robert G. Wilson v, Dec 01 2016 *)
  • PARI
    a(n)=my(p=prime(n),m=p-1); sum(k=1,m, k^m,-p-m!)/p^2 \\ Charles R Greathouse IV, Oct 18 2011

Formula

a(n) = ((Sum_{k=1..p-1} k^(p-1)) - p - (p-1)!)/p^2, where p is the n-th prime and n >= 2.

A275741 Sum of Wilson and Lerch remainders of n-th prime.

Original entry on oeis.org

1, 3, 10, 6, 6, 17, 15, 11, 25, 38, 9, 37, 47, 39, 86, 58, 107, 50, 101, 36, 98, 45, 123, 92, 170, 57, 80, 72, 158, 194, 194, 67, 78, 133, 120, 302, 144, 158, 128, 97, 91, 303, 76, 191, 139, 178, 302, 117, 242, 179, 335, 390, 362, 197, 290, 314, 327, 227, 429
Offset: 2

Views

Author

Felix Fröhlich, Aug 07 2016

Keywords

Comments

a(n) = 0 if and only if prime(n) is in both A007540 and A197632, i.e., prime(n) is simultaneously a Wilson prime and a Lerch prime.
For n > 2, a(n) = 0 if and only if A027641(3*p-3) / A027642(3*p-3)-1 + 1/p == 0 (mod p^2), where p = prime(n) (cf. Dobson, 2016, theorem 2).
René Gy (see links) has shown that a number is simultaneously a Lerch prime and a Wilson prime if and only if it satisfies the congruence (p - 1)! + 1 == 0 (mod p^3). - John Blythe Dobson, Feb 23 2018

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{p = Prime[n]}, Mod[((p-1)!+1)/p, p] + Mod[(Sum[(k^(p-1)-1)/p, {k, 1, p-1}] - ((p-1)!+1)/p)/p, p]];
    Table[a[n], {n, 2, 60}] (* Jean-François Alcover, Feb 15 2019 *)
  • PARI
    a002068(n) = my(p=prime(n)); ((p-1)!+1)/p % p
    a197631(n) = my(p=prime(n), m=p-1); sum(k=1, m, k^m, -p-m!)/p^2 % p
    a(n) = a002068(n) + a197631(n)

Formula

a(n) = A002068(n) + A197631(n).
Showing 1-4 of 4 results.