Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #17 May 21 2016 22:51:04
%S 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,
%T 9,9,10,10,10,10,11,11,12,12,12,12,13,13,13,13,13,13,14,14,14,14,14,
%U 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
%N Number of non-Wilson primes <= n.
%C The analog of pi(n) for non-Wilson primes.
%C 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.
%C 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
%H Felix Fröhlich, <a href="/A197637/b197637.txt">Table of n, a(n) for n = 1..10000</a>
%H E. Costa, R. Gerbicz and D. Harvey, <a href="http://dx.doi.org/10.1090/S0025-5718-2014-02800-7">A search for Wilson primes</a>, Mathematics of Computation, 83 (2014), 3071-3091 (arXiv:<a href="http://arxiv.org/abs/1209.3436">1209.3436</a> [math.NT], 2012).
%F a(A197636(n)) = n
%e There are 3 non-Wilson primes <= 8, namely 2, 3, and 7, so a(8) = 3.
%t 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 *)
%o (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 */
%o (PARI) /* The following program is valid up to n = 2*10^13 (cf. Costa, Gerbicz, Harvey, 2014) */
%o 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 */
%Y Cf. A000720, A197636.
%K nonn
%O 1,3
%A _Jonathan Sondow_, Oct 19 2011