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.

Previous Showing 11-20 of 36 results. Next

A157249 Generalized Wilson quotients (or Wilson quotients for composite moduli).

Original entry on oeis.org

2, 1, 1, 1, 5, 1, 103, 13, 249, 19, 329891, 32, 36846277, 1379, 59793, 126689, 1230752346353, 4727, 336967037143579, 436486, 2252263619, 56815333, 48869596859895986087, 1549256, 1654529071288638505, 23390099351, 56463097772562963, 51860555558, 10513391193507374500051862069
Offset: 1

Views

Author

Jonathan Sondow and Wadim Zudilin, Feb 27 2009

Keywords

Comments

By Wilson's Theorem, for prime p the Wilson quotient ((p-1)!+1)/p is an integer A007619. By Gauss's extension (see Dickson p. 65), the generalized Wilson quotient (P(n)+e(n))/n is an integer, where P(n) = n-phi-torial A001783 and e(n) = +1 or -1 according as n does or does not have a primitive root (see A033948).
For additional references and links, see A007540.

Examples

			P(8) = 3*5*7 = 105 and e(8) = -1, so a(8) = (105-1)/8 = 13.
		

References

  • L. E. Dickson, History of the Theory of Numbers, vol. 1, Divisibility and Primality, Chelsea, New York, 1966.

Crossrefs

Cf. Wilson quotient A007619, Wilson prime A007540, Wilson number A157250, n-phi-torial A001783, numbers having a primitive root A033948.
Cf. A317507.

Programs

  • Maple
    a := proc(n) local A001783,e,i;
    A001783 := proc(n) local i; mul(i,i=select(k->igcd(k,n)=1,[$1..n]))end;
    e := proc(n) local p,r,P; if n=1 or n=2 or n=4 then RETURN(1) fi;
    P := select(isprime,[$3..n]); for p in P do r := p;
    while r <= n do if n = r or n = 2*r then RETURN(1) fi;
    r := r*p; od od; -1 end; (A001783(n)+e(n))/n end:
    # Peter Luschny, Jul 19 2009
  • Mathematica
    p[n_] := Times @@ Select[ Range[n], CoprimeQ[n, #] & ]; e[1 | 2 | 4] = 1; e[n_] := (fi = FactorInteger[n]; If[MatchQ[fi, {{(p_)?OddQ, }} | {{2, 1}, {, }}], 1, -1]); a[n] := (p[n] + e[n])/n; Table[a[n], {n, 1, 25}] (* Jean-François Alcover, Sep 28 2011 *)

Formula

a(n) = (P(n)+e(n))/n, with P(n) = n-phi-torial = A001783(n) and e(n) = +1 if n = 1, 2, 4, p^k or 2p^k, where p is an odd prime and k > 0, and e(n) = -1 otherwise.

A197633 Fermat-Wilson quotients of non-Wilson primes: q_p(w_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 a non-Wilson prime.

Original entry on oeis.org

0, 0, 170578899504, 1387752405580695978098914368989316131852701063520729400
Offset: 1

Views

Author

Jonathan Sondow, Oct 16 2011

Keywords

Comments

A Wilson prime is a prime p that divides its Wilson quotient w_p (see A007619). The known Wilson primes are 5, 13, 563 (see A007540).
If p is a non-Wilson prime (see A197636), then p does not divide w_p, and so by Fermat's little theorem the Fermat quotient q_p(w_p) is an integer.
The next term is the Fermat-Wilson quotient of 17, which has 193 digits.
The Fermat-Wilson quotient of 14771 (see A197635) has over 800 million digits.
The GCD of all Fermat-Wilson quotients is 24. In particular, q_p(w_p) is never prime.

Examples

			The 3rd non-Wilson prime is 7, so a(3) = (((6!+1)/7)^6-1)/7 = 170578899504.
		

Crossrefs

Programs

  • Mathematica
    nmax=4; nonWilsonQ[p_] := Mod[((p-1)!+1)/p ,p] != 0; A197636 = Select[ Prime[ Range[nmax+2]], nonWilsonQ]; a[n_] := With[{p=A197636[[n]]}, ((((p-1)!+1)/p)^(p-1)-1)/p]; Table[ a[n], {n, 1, nmax}] (* Jean-François Alcover, Dec 14 2011 *)

Formula

a(n) = ((((p-1)!+1)/p)^(p-1)-1)/p, where p = A197636(n).

A124405 a(n) = 1 + Sum_{i=1..n} Sum_{j=1..n} i^j.

Original entry on oeis.org

2, 9, 57, 495, 5700, 82201, 1419761, 28501117, 651233662, 16676686697, 472883843993, 14705395791307, 497538872883728, 18193397941038737, 714950006521386977, 30046260016074301945, 1344648068888240941018
Offset: 1

Views

Author

Alexander Adamchuk, Dec 14 2006

Keywords

Comments

p divides a(p) and a(p-1) for prime p.
p^2 divides a(p) for prime p in {5, 13, 563, ...} which seems to coincide with the Wilson primes (A007540).
p^2 divides a(p-1) for prime p in {3, 11, 107, ...} which seems to coincide with the odd primes in A079853.

Crossrefs

Programs

  • GAP
    List([1..30], n-> n+1 + Sum([2..n], j-> j*(j^n-1)/(j-1)) ); # G. C. Greubel, Dec 25 2019
  • Magma
    [0] cat [n+1 + (&+[j*(j^n-1)/(j-1): j in [2..n]]): n in [2..30]]; // G. C. Greubel, Dec 25 2019
    
  • Maple
    seq( n+1+add(j*(j^n-1)/(j-1), j=2..n), n=1..30); # G. C. Greubel, Dec 25 2019
  • Mathematica
    Table[Sum[i^j,{i,1,n},{j,1,n}]+1,{n,1,20}]
  • PARI
    vector(30, n, n+1 + sum(j=2,n, j*(j^n-1)/(j-1)) ) \\ G. C. Greubel, Dec 25 2019
    
  • Sage
    [n+1 + sum(j*(j^n-1)/(j-1) for j in (2..n)) for n in (1..30)] # G. C. Greubel, Dec 25 2019
    

Formula

a(n) = 1 + Sum_{i=1..n} Sum_{j=1..n} i^j.
a(n) = n + 1 + Sum_{j=2..n} j*(j^n - 1)/(j-1).
a(n) = A086787(n) + 1.

Extensions

Edited by Max Alekseyev, Jan 29 2012

A157250 Wilson numbers: k such that the generalized Wilson quotient A157249(k) is divisible by k.

Original entry on oeis.org

1, 5, 13, 563, 5971, 558771, 1964215, 8121909, 12326713, 23025711, 26921605, 341569806, 399292158
Offset: 1

Views

Author

Jonathan Sondow and Wadim Zudilin, Feb 27 2009

Keywords

Comments

A prime p is a Wilson prime if p divides its Wilson quotient A007619. A number n is a Wilson number if n divides its generalized Wilson quotient A157249.
The sequence contains all Wilson numbers <= 5 x 10^8. Heuristics suggest that #(Wilson numbers < N) is about (6/pi^2) log N, for large N.
A Wilson number is prime if and only if it is a Wilson prime A007540. Only three are known: 5, 13, 563.
The first composite Wilson number 5971 was discovered by Kloss, the others by Agoh, Dilcher, and Skula. Every known composite Wilson number n has at least two odd prime factors, so e(n) = -1.
For additional references and links, see A007540.

Examples

			A157249(13) = (A001783(13) + e(13))/13 = ((13-1)! + 1)/13 = 479001601/13 = 36846277 == 0 mod 13, so 13 is a member. A001783(5971) + e(5971) = A001783(5971) - 1 == 0 mod 5971^2, so 5971 is a member. But A157249(8) = (A001783(8) + e(8))/8 = (3*5*7 - 1)/8 = 13 ==/== 0 mod 8, so 8 is not a member.
		

References

  • L. E. Dickson, History of the Theory of Numbers, vol. 1, Divisibility and Primality, Chelsea, New York, 1966, p. 65.

Crossrefs

Cf. Wilson quotient A007619, Wilson prime A007540, generalized Wilson quotient A157249, n-phi-torial A001783, numbers having a primitive root A033948.

Programs

  • Mathematica
    f[n_] := Times @@ Select[Range[n], CoprimeQ[n, #]&];
    e[1|2|4] = 1; e[n_] := If[MatchQ[FactorInteger[n], {{?OddQ, }} | {{2, 1}, {, }}], 1, -1];
    WilsonQ[n_] := IntegerQ[(f[n] + e[n])/n^2];
    Reap[For[k = 1, k < 10^7, k++, If[WilsonQ[k], Print[k]; Sow[k]]]][[2, 1]] (* Jean-François Alcover, Dec 11 2018 *)

Formula

A157249(n) == 0 mod n.
A001783(n) + e(n) == 0 mod n^2, where e(n) = +1 or -1 according as n does or does not have a primitive root.

A128666 Least generalized Wilson prime p such that p^2 divides (n-1)!(p-n)! - (-1)^n; or 0 if no such prime exists.

Original entry on oeis.org

5, 2, 7, 10429, 5, 11, 17
Offset: 1

Views

Author

Alexander Adamchuk, Mar 25 2007

Keywords

Comments

Conjecture: a(n)>0 for all n.
Wilson's theorem states that (p-1)! == -1 (mod p) for every prime p. Wilson primes are the primes p such that p^2 divides (p-1)! + 1. They are listed in A007540. Wilson's theorem can be expressed in general as (n-1)!(p-n)! == (-1)^n (mod p) for every prime p >= n. Generalized Wilson primes are the primes p such that p^2 divides (n-1)!(p-n)! - (-1)^n.
Alternatively, prime p=prime(k) is a generalized Wilson prime order n iff A002068(k) == A007619(k) == H(n-1) (mod p), where H(n-1) = A001008(n-1)/A002805(n-1) is (n-1)-st harmonic number.
Generalized Wilson primes of order 2 are listed in A079853. Generalized Wilson primes of order 17 are listed in A152413.
a(9)-a(11) = {541,11,17}.
a(13) = 13.
a(15)-a(21) = {349, 31, 61, 13151527, 71, 59, 217369}.
a(24) = 47.
a(26)-a(28) = {97579, 53, 347}.
a(30)-a(37) = {137, 20981, 71, 823, 149, 71, 4902101, 71}.
a(39)-a(45) = {491, 59, 977, 1192679, 47, 3307, 61}.
a(47) = 14197.
a(49) = 149.
a(51) = 3712567.
a(53)-a(65) = {71, 2887, 137, 35677, 467, 443, 636533, 17257, 2887, 80779, 173, 237487, 1013}.
a(67)-a(76) = {523, 373, 2341, 359, 409, 14273449, 5651, 7993, 28411, 419}.
a(78) = 227.
a(80)-a(81) = {33619,173}.
a(83) = 137.
a(85)-a(86) = {983, 6601909}.
a(88) = 859.
a(90) = 2267.
a(92)-a(94) = {1489,173,6970961}.
a(97) = 453161
a(100) = 4201.
For n<100, a(n) > 1.4*10^7 is currently not known for n in { 8, 12, 14, 22, 23, 25, 29, 31, 38, 46, 48, 50, 52, 66, 77, 79, 82, 84, 87, 89, 91, 95, 96, 98, 99 }.

Crossrefs

Formula

If it exists, a(n) >= n. a(n) = n for n in {2, 5, 13, 563, ...} = the union of prime 2 and Wilson primes A007540.

Extensions

Edited and updated by Alexander Adamchuk, Nov 06 2010
Edited and a(18), a(21), a(26), a(36), a(42), a(51), a(59), a(62), a(64), a(72), a(86), a(94), a(97) added by Max Alekseyev, Jan 29 2012
Edited by M. F. Hasler, Dec 31 2015

A197635 Wieferich-non-Wilson primes: non-Wilson primes that divide their Fermat-Wilson quotient A197633.

Original entry on oeis.org

2, 3, 14771
Offset: 1

Views

Author

Jonathan Sondow, Oct 16 2011

Keywords

Comments

A Wieferich prime base a is a prime p satisfying a^(p-1) == 1 (mod p^2). A non-Wilson prime p is called a Wieferich-non-Wilson prime if p is a Wieferich prime base w_p, where w_p = ((p-1)!+1)/p is the Wilson quotient of p.
Michael Mossinghoff has computed that if a 4th Wieferich-non-Wilson prime exists, it is > 10^7.

Examples

			The first two non-Wilson primes are 2 and 3, whose Fermat-Wilson quotients are 0. Since 2 and 3 divide 0, they are members.
The 1728th non-Wilson prime is prime(1731) = 14771, and A197634(1728) = 0, so 14771 is a member.
		

Crossrefs

Formula

A197634(A197637(a(n))) = 0.
(((p-1)!+1)/p)^(p-1) == 1 (mod p^2), where p = a(n).

A112660 a(n) = (p-1)! mod p^2 where p = n-th prime.

Original entry on oeis.org

1, 2, 24, 34, 10, 168, 84, 37, 183, 521, 588, 258, 655, 558, 281, 1801, 1592, 3415, 803, 4898, 802, 5766, 1659, 6229, 6789, 7271, 5870, 106, 3269, 10734, 9016, 15588, 7671, 9312, 14005, 12985, 23706, 17603, 3506, 18337, 8591, 13031, 30368, 6754, 28958, 23481, 36502, 40139
Offset: 1

Views

Author

Roger Hui, Dec 28 2005

Keywords

Comments

Related to the Wilson primes A007540, which are primes p such that (p-1)! = -1 mod p^2.

Crossrefs

Programs

  • Magma
    [Factorial(NthPrime(n)-1) mod NthPrime(n)^2 : n in [1..50]]; // G. C. Greubel, Dec 17 2019
    
  • Maple
    seq(`mod`(factorial(ithprime(n)-1), ithprime(n)^2), n = 1..50); # G. C. Greubel, Dec 17 2019
  • Mathematica
    Table[Mod[(Prime[n]-1)!, Prime[n]^2], {n, 50}] (* G. C. Greubel, Dec 17 2019 *)
  • PARI
    a(n) = my(p=prime(n)); (p-1)! % p^2; \\ Michel Marcus, Dec 17 2019
    
  • Sage
    [mod(factorial(nth_prime(n)-1), nth_prime(n)^2) for n in (1..50)] # G. C. Greubel, Dec 17 2019

Formula

a(n) = A177771(n) mod A001248(n). - Michel Marcus, Dec 17 2019

Extensions

Offset 1 and more terms from Michel Marcus, Dec 17 2019

A115091 Primes p such that p^2 divides m!+1 for some integer m

Original entry on oeis.org

5, 11, 13, 47, 71, 563, 613
Offset: 1

Views

Author

T. D. Noe, Mar 01 2006

Keywords

Comments

By Wilson's theorem, we know that there is an m=p-1 such that p divides m!+1. Sequence A115092 gives the number of m for each prime. Occasionally p^2 also divides m!+1. These primes seem to be only slightly more plentiful than Wilson primes (A007540). No other primes < 10^6.
There is no prime p < 10^8 such that p^2 divides m!+1 for some m <= 1200. [From F. Brunault (brunault(AT)gmail.com), Nov 23 2008]
For a(n), m = p-A259230(n). - Felix Fröhlich, Jan 24 2016

References

  • R. K. Guy, Unsolved Problems in Number Theory, 3rd Ed., New York, Springer-Verlag, 2004, Section A2.

Crossrefs

Cf. A064237 (n!+1 is divisible by a square), A259230.

Programs

  • Mathematica
    nn=1000; lst={}; Do[p=Prime[i]; p2=p^2; f=1; m=1; While[m
  • PARI
    forprime(p=1, , for(k=1, p-1, if(Mod((p-k)!, p^2)==-1, print1(p, ", "); break({1})))) \\ Felix Fröhlich, Jan 24 2016

A152413 Generalized Wilson primes of order 17; or primes p such that p^2 divides 16!(p-17)! + 1.

Original entry on oeis.org

61, 251, 479
Offset: 1

Views

Author

Alexander Adamchuk, Dec 03 2008

Keywords

Comments

Wilson's theorem states that (p-1)! == -1 (mod p) for every prime p. Wilson primes are the primes p such that p^2 divides (p-1)! + 1. They are listed in A007540. Wilson's theorem can be expressed in general as (n-1)!(p-n)! == (-1)^n (mod p) for every prime p >= n. Generalized Wilson primes order n are the primes p such that p^2 divides (n-1)!(p-n)! - (-1)^n.
Alternatively, prime p=prime(k) is a generalized Wilson prime order n iff A002068(k) == A007619(k) == H(n-1) (mod p), where H(n-1) = A001008(n-1)/A002805(n-1) is (n-1)-st harmonic number. For this sequence (n=17), it reduces to A002068(k) == A007619(k) == 2436559/720720 (mod p).

Crossrefs

Extensions

Edited by Max Alekseyev, Jan 28 2012

A250407 Near-Wilson primes (p = prime(n) satisfying (p-1)! == -1-A250406(n)*p (mod p^2)) with A250406(n) < 10.

Original entry on oeis.org

2, 3, 5, 7, 13, 61, 71, 79, 157, 281, 563, 1277, 1777, 2339, 6311, 8233, 8543, 11047, 22907, 27689
Offset: 1

Views

Author

Felix Fröhlich, Nov 22 2014

Keywords

Comments

A250406(n) is essentially A007619(n) modulo A000040(n) (see Crandall et al. (1997), p. 442).

Crossrefs

Programs

  • PARI
    forprime(p=1, 1e9, for(b=0, 9, if(Mod((p-1)!, p^2)==-1-b*p, print1(p, ", "); break({1}))))
Previous Showing 11-20 of 36 results. Next