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.

A197637 Number of non-Wilson primes <= n.

Original entry on oeis.org

0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23
Offset: 1

Views

Author

Jonathan Sondow, Oct 19 2011

Keywords

Comments

The analog of pi(n) for non-Wilson primes.
An inverse function of A197636, as A197636(a(n)) = n if and only if n is a non-Wilson prime, i.e., a member of A197636.
Empirical evidence suggests that the sequence is unbounded, i.e., that A197636 is infinite, although no proof seems to be known. - Felix Fröhlich, May 18 2016

Examples

			There are 3 non-Wilson primes <= 8, namely 2, 3, and 7, so a(8) = 3.
		

Crossrefs

Programs

  • Mathematica
    nmax = 100; nonWilsonQ[p_] := Mod[((p-1)! + 1)/p, p] != 0; nonWilsonPrimes = Select[ Prime[ Range[nmax + 2]], nonWilsonQ]; a[n_] := Count[ nonWilsonPrimes, k_ /; k <= n]; Table[a[n], {n, 1, nmax}] (* Jean-François Alcover, Oct 10 2012 *)
  • PARI
    my(i=0); for(n=1, 50, if(ispseudoprime(n) && Mod((n-1)!, n^2)!=-1, i++); print1(i, ", ")) /* Felix Fröhlich, May 18 2016 */
    
  • PARI
    /* The following program is valid up to n = 2*10^13 (cf. Costa, Gerbicz, Harvey, 2014) */
    my(w=[5, 13, 563], i=0); for(n=1, 200, for(k=1, #w, if(n==w[k], i++)); print1(primepi(n)-i, ", ")) /* Felix Fröhlich, May 18 2016 */

Formula

a(A197636(n)) = n