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-8 of 8 results.

A007540 Wilson primes: primes p such that (p-1)! == -1 (mod p^2).

Original entry on oeis.org

5, 13, 563
Offset: 1

Views

Author

Keywords

Comments

Suggested by the Wilson-Lagrange Theorem: An integer p > 1 is a prime if and only if (p-1)! == -1 (mod p). Cf. Wilson quotients, A007619.
Sequence is believed to be infinite. Next term is known to be > 2*10^13 (cf. Costa et al., 2013).
Intersection of the Wilson numbers A157250 and the primes A000040. - Jonathan Sondow, Mar 04 2016
Conjecture: Odd primes p such that 1^(p-1) + 2^(p-1) + ... + (p-1)^(p-1) == p-1 (mod p^2). - Thomas Ordowski and Giovanni Resta, Jul 25 2018
From Felix Fröhlich, Nov 16 2018: (Start)
Harry S. Vandiver apparently said about the Wilson primes "It is not known if there are infinitely many Wilson primes. This question seems to be of such a character that if I should come to life any time after my death and some mathematician were to tell me that it had definitely been settled, I think I would immediately drop dead again." (cf. Ribenboim, 2000, p. 217).
Let p be a Wilson prime and let i be the index of p in A000040. For n = 1, 2, 3, the values of i are 3, 6, 103. The primes among those values are Lerch primes, i.e., terms of A197632. Is this a property that necessarily follows if i is prime (cf. Sondow, 2011/2012, 2.5 Open Problems 5)? (End)
From Amiram Eldar, Jun 16 2021: (Start)
Named after the English mathematician John Wilson (1741-1793) after whom "Wilson's theorem" was also named.
The primes 5 and 13 appear in an exercise involving the Wilson congruence in Mathews (1892). [Edited by Felix Fröhlich, Jul 23 2021]
Beeger found that there are no other smaller terms up to 114 (1913) and up to 200 (1930).
a(3) = 563 was found by Goldberg (1953), who used the Bureau of Standards Eastern Automatic Computer (SEAC) to search all primes less than 10000. According to Goldberg, the third prime was discovered independently by Donald Wall six month later. (End)

References

  • N. G. W. H. Beeger, On the Congruence (p-1)! == -1 (mod p^2), Messenger of Mathematics, Vol. 49 (1920), pp. 177-178.
  • Albert H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 52.
  • Calvin C. Clawson, Mathematical Mysteries, Plenum Press, 1996, p. 180.
  • Richard Crandall and Carl Pomerance, Prime Numbers: A Computational Perspective, Springer, NY, 2001; see p. 29.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, th. 80.
  • G. B. Mathews, Theory of Numbers Part I., Cambridge: Deighton, Bell and Co., London: George Bell and Sons, 1892, page 318.
  • Paulo Ribenboim, My Numbers, My Friends: Popular Lectures on Number Theory, Springer Science & Business Media, 2000, ISBN 0-387-98911-0.
  • Paulo Ribenboim, The Book of Prime Number Records. Springer-Verlag, NY, 2nd ed., 1989, p. 277.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 234-235.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Ilan Vardi, Computational Recreations in Mathematica. Addison-Wesley, Redwood City, CA, 1991, p. 73.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, NY, 1986, p. 163.

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[500]], Mod[(# - 1)!, #^2] == #^2 - 1 &] (* Harvey P. Dale, Mar 30 2012 *)
  • PARI
    forprime(n=2, 10^9, if(Mod((n-1)!, n^2)==-1, print1(n, ", "))) \\ Felix Fröhlich, Apr 28 2014
    
  • PARI
    is(n)=prod(k=2,n-1,k,Mod(1,n^2))==-1 \\ Charles R Greathouse IV, Aug 03 2014
    
  • Python
    from sympy import prime
    A007540_list = []
    for n in range(1,10**4):
        p, m = prime(n), 1
        p2 = p*p
        for i in range(2,p):
            m = (m*i) % p2
        if m == p2-1:
            A007540_list.append(p) # Chai Wah Wu, Dec 04 2014

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.

A197631 Lerch remainders: the Lerch quotient A197630 of the n-th prime p modulo p, where n > 1.

Original entry on oeis.org

0, 3, 5, 5, 6, 12, 13, 3, 7, 19, 2, 21, 34, 33, 52, 31, 51, 38, 32, 25, 25, 25, 53, 22, 98, 0, 79, 42, 63, 123, 75, 11, 11, 39, 34, 151, 36, 137, 22, 49, 19, 144, 41, 44, 21, 5, 122, 4, 111, 10, 228, 194, 148, 20, 217, 193, 157, 202, 152, 87, 93, 30, 219
Offset: 2

Views

Author

Jonathan Sondow, Oct 16 2011

Keywords

Examples

			a(3) = A197630(3) mod Prime(3) = 13 mod 5 = 3.
		

Crossrefs

Programs

  • PARI
    a(n) = my(p=prime(n), m=p-1); sum(k=1, m, k^m, -p-m!)/p^2 % p;
    vector(100, n, a(n+1)) \\ Altug Alkan, Nov 22 2015

Formula

a(n) = A197630(n) mod Prime(n), with 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).

A308963 Lerch pseudoprimes: composite numbers m such that Sum_{k=1..m-1} k^{m-1} - (m-1)! == m (mod m^2).

Original entry on oeis.org

77, 161, 2261, 12839, 14231, 18668831, 1591100357
Offset: 1

Views

Author

Amiram Eldar and Thomas Ordowski, Jul 03 2019

Keywords

Comments

According to Lerch's congruence (1905), if p is an odd prime, then Sum_{k=1..p-1} k^(p-1) - (p-1)! == p (mod p^2).
Equivalently, numbers m > 4 such that Sum_{k=1..m-1} k^(m-1) == m (mod m^2).
Equivalently, numbers m > 1 such that m*B_{m-1} == m (mod m^2), where B_k is the k-th Bernoulli number.
Equivalently, terms m of A121707 such that B_{m-1} == 1 (mod m).
Equivalently, numbers m > 1 such that A027641(m-1) == A027642(m-1) (mod m).
If m is a Lerch pseudoprime, then p-1 does not divide m-1 for every prime divisor p of m.
From M. F. Hasler, Jul 22 2019: (Start)
The Lerch primes A197632 satisfy Lerch's congruence "even" modulo p^3.
Up to a(7) all terms are either multiples of 7 or of 37, but not both. Will this pattern prevail?
We also note: a(1) = 7*11; a(2) = 7*(2*11 + 1) = a(1)/11*23; a(3) = 7*(2*7*23 + 1) = a(2)/23*17*19, a(5) = a(3)/17*107, i.e., a term in this subsequence has all but one of the prime factors of the preceding one. The subsequence (a(4), a(6), ...?) of terms divisible by 37 so far consists of semiprimes and therefore also has this property. (End)

Crossrefs

A subsequence of A191677 and A121707.

Programs

  • Mathematica
    s={}; Do[If[CompositeQ[n] && Mod[Sum[PowerMod[k, n-1, n^2], {k, 1, n-1}] - (n-1)! - n, n^2] == 0, AppendTo[s, n]],{n,1,2500}] ; s
  • PARI
    is_A308963(m)={sum(k=1,m-1,Mod(k,m^2)^(m-1))==m&&!isprime(m)&&m>4}
    forcomposite(m=1,,is_A308963(m)&&print1(m",")) \\ Slow beyond 10000. - M. F. Hasler, Jul 22 2019

Extensions

a(6)-a(7) from Max Alekseyev, Jul 09 2019

A276808 Odd prime numbers p such that p*Bernoulli(p-1) + (p-1)!*(p-1) == 0 (mod p^3).

Original entry on oeis.org

17, 1733, 18433
Offset: 1

Views

Author

René Gy, Sep 18 2016

Keywords

Comments

For all other odd primes, the congruence holds mod p^2 only.

Crossrefs

Programs

  • PARI
    lista(nn) = {forprime(p=3, nn, if (!((p*bernfrac(p-1) + (p-1)!*(p-1)) % p^3) , print1(p, ", ")););} \\ Michel Marcus, Sep 18 2016

A319025 Primes p such that W_p == 2 (mod p), where W_p = A007619(n) and p = prime(n).

Original entry on oeis.org

19, 1187, 14296621, 16556218163369
Offset: 1

Views

Author

Felix Fröhlich, Sep 08 2018

Keywords

Comments

These are the members of René Gy's set W_2 (cf. Gy, 2018).
The sequence is complete to 2*10^13, with the higher terms coming from a list of primes with small Wilson quotients in the article by Costa, Gerbicz, and Harvey. - John Blythe Dobson, Jan 05 2021

Crossrefs

Programs

  • PARI
    forprime(p=1, , if(Mod(((p-1)!+1)/p, p)==2, print1(p, ", ")))

A365098 Primes p such that Sum_{k=1..p-1} q^2_p(k) == 0 (mod p), with q_p(k) a Fermat quotient.

Original entry on oeis.org

2, 11, 971
Offset: 1

Views

Author

Felix Fröhlich, Aug 21 2023

Keywords

Comments

The congruence in the definition is given in Gy, 2018, Eq. 16.
The terms, except for the prime 2, satisfy the congruence B_{p-1} - 1 + 1/p == (B_{2p-2} - 1 + 1/p)/2 (mod p^2), with B_i a Bernoulli number (cf. Gy, 2018, Eq. 18).
Any odd prime that is a term of both A007540 and A197632, i.e., that is simultaneously a Wilson prime and a Lerch prime, is in this sequence (cf. Gy, 2018, Theorem 5).
An equivalent definition, better suited for computational purposes, is: "Primes p such that Sum_{k=1..p-1} (k^(p-1) - 1)^2 == 0 (mod p^3)." - John Blythe Dobson, Apr 30 2024
a(4) > 427000, if it exists (Gy, 2018). - Amiram Eldar, Aug 22 2023
a(4) > 39540000, if it exists. - John Blythe Dobson, Apr 30 2024

Crossrefs

Programs

  • Mathematica
    Join[{2}, Select[Prime[Range[2, 200]], Divisible[Numerator[BernoulliB[# - 1] - 1 + 1/# - (BernoulliB[2*# - 2] - 1 + 1/#)/2], #^2] &]] (* Amiram Eldar, Aug 22 2023 *)
  • PARI
    forprime(p = 2, 10000, if(sum(j=1, p-1, (Mod(j, p^3)^(p-1) - 1)^2) % p^3 == 0, print1(p, ", "))) /* John Blythe Dobson, Apr 30 2024 */
Showing 1-8 of 8 results.