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-10 of 41 results. Next

A163212 Wilson quotients (A007619) which are primes.

Original entry on oeis.org

5, 103, 329891, 10513391193507374500051862069
Offset: 1

Views

Author

Peter Luschny, Jul 24 2009

Keywords

Comments

a(5) = A007619(137), a(6) = A007619(216), a(7) = A007619(381).
Same as A122696 without its initial term 2. - Jonathan Sondow, May 19 2013

Examples

			The quotient (720+1)/7 = 103 is a Wilson quotient and a prime, so 103 is a member.
		

Crossrefs

Programs

  • Maple
    # WQ defined in A163210.
    A163212 := n -> select(isprime,WQ(factorial,p->1,n)):
  • Mathematica
    Select[Table[p = Prime[n]; ((p-1)!+1)/p, {n, 1, 15}], PrimeQ] (* Jean-François Alcover, Jun 28 2013 *)
  • PARI
    forprime(p=2, 1e4, a=((p-1)!+1)/p; if(ispseudoprime(a), print1(a, ", "))) \\ Felix Fröhlich, Aug 03 2014

Formula

a(n) = A122696(n+1) = A007619(A225906(n)) = ((A050299(n+1)-1)!+1)/A050299(n+1). - Jonathan Sondow, May 19 2013

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, ", ")))

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

A089026 a(n) = n if n is a prime, otherwise a(n) = 1.

Original entry on oeis.org

1, 2, 3, 1, 5, 1, 7, 1, 1, 1, 11, 1, 13, 1, 1, 1, 17, 1, 19, 1, 1, 1, 23, 1, 1, 1, 1, 1, 29, 1, 31, 1, 1, 1, 1, 1, 37, 1, 1, 1, 41, 1, 43, 1, 1, 1, 47, 1, 1, 1, 1, 1, 53, 1, 1, 1, 1, 1, 59, 1, 61, 1, 1, 1, 1, 1, 67, 1, 1, 1, 71, 1, 73, 1, 1, 1, 1, 1, 79, 1, 1, 1, 83, 1, 1, 1, 1, 1, 89, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Roger L. Bagula, Nov 12 2003

Keywords

Comments

This sequence was the subject of the 1st problem of the 9th Irish Mathematical Olympiad 1996 with gcd((n + 1)!, n! + 1) = a(n+1) for n >= 0 (see formula Jan 23 2009 and link). - Bernard Schott, Jul 22 2020
For sequence A with terms a(1), a(2), a(3),... , let R(0) = 1 and for k >= 1 let R(k) = rad(a(1)*a(2)*...*a(k)). Define the Rad-transform of A to be R(n)/R(n-1); n >= 1, where rad is A007947. Then this sequence is the Rad transform of the positive integers, A = A000027. - David James Sycamore, Apr 19 2024

Examples

			From Larry Tesler (tesler(AT)pobox.com), Nov 08 2010: (Start)
a(9) = (8*9*10)/(2^((5+2+1)-(3+1+0))*3^((3+1)-(2+0))*5^((2)-(1))*7^((1)-(1))) = 1 [composite].
a(10) = (8*9*10)/(2^((5+2+1)-(3+1+0))*3^((3+1)-(2+0))*5^((2)-(1))*7^((1)-(1))) = 1 [composite].
a(11) = (8*9*10*11*12)/(2^((6+3+1)-(3+1+0))*3^((4+1)-(2+0))*5^((2)-(1))*7^((1)-(1))) = 11 [prime]. (End)
		

References

  • Paulo Ribenboim, The little book of big primes, Springer 1991, p. 106.
  • L. Tesler, "Factorials and Primes", Math. Bulletin of the Bronx H.S. of Science (1961), 5-10. [From Larry Tesler (tesler(AT)pobox.com), Nov 08 2010]

Crossrefs

Differs from A080305 at n=30.

Programs

  • MATLAB
    a = [1:96]; a(isprime(a) == false) = 1; % Thomas Scheuerle, Oct 06 2022
    
  • Magma
    [IsPrime(n) select n else 1: n in [1..96]]; // Marius A. Burtea, Aug 02 2019
    
  • Mathematica
    digits=200; a=Table[If[PrimePi[n]-PrimePi[n-1]>0, n, 1], {n, 1, digits}]; Table[Numerator[(n/2)/(n-1)! ] + Floor[2/n] - 2*Floor[1/n], {n,1,200}] (* Alexander Adamchuk, May 20 2006 *)
    Range@ 120 /. k_ /; CompositeQ@ k -> 1 (* or *)
    Table[n Boole@ PrimeQ@ n, {n, 120}] /. 0 -> 1 (* or *)
    Table[If[PrimeQ@ n, n, 1], {n, 120}] (* Michael De Vlieger, Jul 02 2016 *)
  • PARI
    a(n) = n^isprime(n) \\ David A. Corneth, Oct 06 2022
  • Python
    from sympy import isprime
    def a(n): return n if isprime(n) else 1
    print([a(n) for n in range(1, 97)]) # Michael S. Branicky, Oct 06 2022
    
  • Sage
    def A089026(n):
        if n == 4: return 1
        f = factorial(n-1)
        return (f + 1) - n*(f//n)
    [A089026(n) for n in (1..96)]   # Peter Luschny, Oct 16 2013
    

Formula

From Peter Luschny, Nov 29 2003: (Start)
a(n) = denominator(n! * Sum_{m=0..n} (-1)^m*m!*Stirling2(n+1, m+1)/(m+1)).
a(n) = denominator(n! * Sum_{m=0..n} (-1)^m*m!*Stirling2(n, m)/(m+1)). (End)
From Alexander Adamchuk, May 20 2006: (Start)
a(n) = numerator((n/2)/(n-1)!) + floor(2/n) - 2*floor(1/n).
a(n) = A090585(n-1) = A000217(n-1)/A069268(n-1) for n>2. (End)
a(n) = gcd(n,(n-1)!+1). - Jaume Oliver Lafont, Jul 17 2008, Jan 23 2009
a(1) = 1, a(2) = 2, then a(n) = 1 or a(n) = n = prime(m) = (Product q+k, k = 1 .. 2*floor(n/2+1)-q) / (Product prime(i)^(Sum (floor((n+1)/(prime(i)^w)) - floor(q/(prime(i)^w)) ), w = 1 .. floor(log[base prime(i)] n+1) ), i = 2 .. m-1) where q = prime(m-1). - Larry Tesler (tesler(AT)pobox.com), Nov 08 2010
a(n) = (n!*HarmonicNumber(n) mod n)+1, n != 4. - Gary Detlefs, Dec 03 2011
a(n) = denominator of (n!)/n^(3/2). - Arkadiusz Wesolowski, Dec 04 2011
a(n) = A034386(n+1)/A034386(n). - Eric Desbiaux, May 10 2013
a(n) = n^c(n), where c = A010051. - Wesley Ivan Hurt, Jun 16 2013
a(n) = A014963(n)^(-A008683(n)). - Mats Granvik, Jul 02 2016
Conjecture: for n > 3, a(n) = gcd(n, A007406(n-1)). - Thomas Ordowski, Aug 02 2019
a(n) = 1 + c(n)*(n-1), where c = A010051. - Wesley Ivan Hurt, Jun 21 2025

A000940 Number of n-gons with n vertices.

Original entry on oeis.org

1, 2, 4, 12, 39, 202, 1219, 9468, 83435, 836017, 9223092, 111255228, 1453132944, 20433309147, 307690667072, 4940118795869, 84241805734539, 1520564059349452, 28963120073957838, 580578894859915650, 12217399235411398127, 269291841184184374868, 6204484017822892034404
Offset: 3

Views

Author

Keywords

Comments

Number of inequivalent undirected Hamiltonian cycles in complete graph on n labeled nodes under action of dihedral group of order 2n acting on nodes.

Examples

			Label the vertices of a regular n-gon 1,2,...,n.
For n=3,4,5 representatives for the polygons counted here are:
  (1,2,3,1),
  (1,2,3,4,1), (1,2,4,3,1),
  (1,2,3,4,5,1), (1,2,3,5,4,1), (1,2,4,5,3,1), (1,3,5,2,4,1).
For n=6:
  (1,2,3,4,5,6,1), (1,2,3,4,6,5,1), (1,2,3,5,6,4,1),
  (1,2,3,6,5,4,1), (1,2,4,3,6,5,1), (1,2,4,6,3,5,1),
  (1,2,4,6,5,3,1), (1,2,5,3,6,4,1), (1,2,5,4,6,3,1),
  (1,2,5,6,3,4,1), (1,2,6,4,5,3,1), (1,3,5,2,6,4,1).
		

References

  • J. H. Kwak and J. Lee, Enumeration of graph coverings, surface branched coverings and related group theory, in Combinatorial and Computational Mathematics (Pohang, 2000), ed. S. Hong et al., World Scientific, Singapore 2001, pp. 97-161.
  • R. C. Read, Some Enumeration Problems in Graph Theory. Ph.D. Dissertation, Department of Mathematics, Univ. London, 1958.
  • 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

Cf. A000939, A007619. Bisections give A094156, A094157.
For permutation classes under various symmetries see A089066, A262480, A002619.

Programs

  • Maple
    with(numtheory);
    # for n odd:
    Sd:=proc(n) local t1,d; t1:=2^((n-1)/2)*n^2*((n-1)/2)!; for d from 1 to n do if n mod d = 0 then t1:=t1+phi(n/d)^2*d!*(n/d)^d; fi; od: t1/(4*n^2); end;
    # for n even:
    Se:=proc(n) local t1,d; t1:=2^(n/2)*n*(n+6)*(n/2)!/4; for d from 1 to n do if n mod d = 0 then t1:=t1+phi(n/d)^2*d!*(n/d)^d; fi; od: t1/(4*n^2); end;
    A000940:=n-> if n mod 2 = 0 then Se(n) else Sd(n); fi;
  • Mathematica
    a[n_] := (t1 = If[OddQ[n], 2^((n - 1)/2)*n^2*((n - 1)/2)!, 2^(n/2)*n*(n + 6)*(n/2)!/4]; For[ d = 1 , d <= n, d++, If[Mod[n, d] == 0, t1 = t1 + EulerPhi[n/d]^2*d!*(n/d)^d]]; t1/(4*n^2)); Table[a[n], {n, 3, 25}] (* Jean-François Alcover, Jun 19 2012, after Maple *)
  • PARI
    a(n)={if(n<3, 0, (2^(n\2-2)*(n\2)!*n*if(n%2, 4*n, n + 6) + sumdiv(n, d, eulerphi(n/d)^2*d!*(n/d)^d))/(4*n^2))} \\ Andrew Howroyd, Sep 09 2018
    
  • Python
    from sympy import factorial, divisors, totient
    def A000940(n): return 1 if n == 3 else ((sum(totient(m:=n//d)**2*factorial(d)*m**d for d in divisors(n,generator=True))+(1<<(k:=n>>1)-2)*n*(n<<2 if n&1 else (n+6))*factorial(k))>>2)//n//n # Chai Wah Wu, Nov 07 2022

Formula

For formula see Maple lines.
a(p) = ((((p-1)! + 1)/p) + p - 2 + (2^((p-1)/2)*((p-1)/2)!))/4 for prime p. See A007619. - Ian Mooney, Oct 05 2022
a(n) ~ sqrt(2*Pi)/4 * n^(n-3/2) / e^n. - Ludovic Schwob, Nov 03 2022

Extensions

More terms from Pab Ter (pabrlos(AT)yahoo.com), May 05 2004

A238693 Quotients connected with the Banach matchboxes problem: Sum_{i=1..prime(n)-5} 2^(i-1)*binomial(i+1,2)/prime(n) (case 2).

Original entry on oeis.org

0, 1, 93, 571, 16143, 79333, 1755225, 160251339, 705725473, 57691858003, 1057609507815, 4500326662525, 80662044522801, 5995948088798691, 437230824840308493, 1820340203482736875, 130228506669621162901, 2230237339841166071433, 9214275012380069727751
Offset: 3

Views

Author

Vladimir Shevelev, Mar 03 2014

Keywords

Comments

A general congruence connected with the Banach matchboxes problem is the following: for k=1,2,...,(p-1)/2, Sum_{i=1..p-2k-1} 2^(i-1)*binomial(k-1+i,k) == 0 (mod p) (p is odd prime). If k=1 (case 1), then one can prove that the corresponding quotients are 2^(prime(n)-3) - A007663(n), n >= 2.

Crossrefs

Programs

  • Mathematica
    Array[Sum[2^(i - 1)*Binomial[i + 1, 2]/#, {i, # - 5}] &@ Prime@ # &, 19, 3] (* Michael De Vlieger, Dec 06 2018 *)
  • PARI
    a(n) = sum(i=1, prime(n)-5, 2^(i-1)*binomial(i+1,2))/prime(n); \\ Michel Marcus, Dec 06 2018

Extensions

More terms from Peter J. C. Moses, Mar 03 2014

A050299 Numbers k such that ((k-1)! + 1)/k is prime.

Original entry on oeis.org

1, 5, 7, 11, 29, 773, 1321, 2621
Offset: 1

Views

Author

N. J. A. Sloane, Apr 09 2003

Keywords

Comments

Except for the first term, all terms are primes because for n > 1, n divides (n-1)! + 1 iff n is prime. - Farideh Firoozbakht, Mar 19 2004
a(9) >= 30941.

Examples

			7 is in the sequence because (6!+1)/7=103 is prime.
		

Programs

  • Mathematica
    v={1};Do[If[PrimeQ[((Prime[n]-1)!+1)/Prime[n]], v=Append[v, Prime[n]];Print[v]], {n, 845}]
    Select[Range[2630],PrimeQ[((#-1)!+1)/#]&] (* Harvey P. Dale, Aug 18 2024 *)
  • PARI
    is(n)=((n-1)!+1)%n==0 && isprime(((n-1)!+1)/n) \\ Anders Hellström, Nov 22 2015

Formula

((a(n)-1)! + 1)/a(n) = A122696(n) = A007619(A000720(A050299(n))) for n > 1. - Jonathan Sondow, Aug 07 2011
a(n) = prime(A225906(n-1)) for n > 1. - Jonathan Sondow, May 20 2013

Extensions

a(7)-a(8) from Mike Oakes, Aug 20 2003

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

A163210 Swinging Wilson quotients ((p-1)$ +(-1)^floor((p+2)/2))/p, p prime. Here '$' denotes the swinging factorial function (A056040).

Original entry on oeis.org

1, 1, 1, 3, 23, 71, 757, 2559, 30671, 1383331, 5003791, 245273927, 3362110459, 12517624987, 175179377183, 9356953451851, 509614686432899, 1938763632210843, 107752663194272623
Offset: 1

Views

Author

Peter Luschny, Jul 24 2009

Keywords

Examples

			The 5th prime is 11, (11-1)$ = 252, the remainder term is (-1)^floor((11+2)/2)=1. So the quotient (252+1)/11 = 23 is the 5th member of the sequence.
		

Crossrefs

Programs

  • Maple
    swing := proc(n) option remember; if n = 0 then 1 elif irem(n, 2) = 1 then swing(n-1)*n else 4*swing(n-1)/n fi end:
    WQ := proc(f,r,n) map(p->(f(p-1)+r(p))/p,select(isprime,[$1..n])) end:
    A163210 := n -> WQ(swing,p->(-1)^iquo(p+2,2),n);
  • Mathematica
    sf[n_] := n!/Quotient[n, 2]!^2; a[n_] := (p = Prime[n]; (sf[p - 1] + (-1)^Floor[(p + 2)/2])/p); Table[a[n], {n, 1, 19}] (* Jean-François Alcover, Jun 28 2013 *)
    a[p_] := (Binomial[p-1, (p-1)/2] - (-1)^((p-1)/2)) / p
    Join[{1, 1}, a[Prime[Range[3,20]]]] (* Peter Luschny, May 13 2017 *)
  • PARI
    a(n, p=prime(n)) = ((p-1)!/((p-1)\2)!^2 - (-1)^(p\2))/p \\ David A. Corneth, May 13 2017

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

Original entry on oeis.org

2, 3, 7, 11, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 569
Offset: 1

Views

Author

Jonathan Sondow, Oct 19 2011

Keywords

Comments

All primes except 5, 13, 563, and any other Wilson prime A007540 that may exist.
Same as primes p that do not divide their Wilson quotient ((p-1)!+1)/p.
Wilson's theorem says that (p-1)! == -1 (mod p) if and only if p is prime.
p = prime(i) is a term iff A250406(i) != 0. - Felix Fröhlich, Jan 24 2016
Complement of A007540 in A000040. - Felix Fröhlich, Jan 24 2016

Examples

			2 is a non-Wilson prime since (2-1)! = 1 ==/== -1 (mod 2^2).
		

Crossrefs

Programs

  • Mathematica
    Select[Prime@ Range@ 104, Mod[Factorial[# - 1], #^2] != #^2 - 1 &] (* Michael De Vlieger, Jan 24 2016 *)
  • PARI
    forprime(p=1, 500, if(Mod((p-1)!, p^2)!=-1, print1(p, ", "))) \\ Felix Fröhlich, Jan 24 2016

Formula

((p-1)!+1)/p =/= 0 (mod p), where p is prime.
Showing 1-10 of 41 results. Next