OFFSET
1,3
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
LINKS
Felix Fröhlich, Table of n, a(n) for n = 1..10000
E. Costa, R. Gerbicz and D. Harvey, A search for Wilson primes, Mathematics of Computation, 83 (2014), 3071-3091 (arXiv:1209.3436 [math.NT], 2012).
FORMULA
a(A197636(n)) = n
EXAMPLE
There are 3 non-Wilson primes <= 8, namely 2, 3, and 7, so a(8) = 3.
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 *)
PROG
(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 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Jonathan Sondow, Oct 19 2011
STATUS
approved