login

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”).

A197637
Number of non-Wilson primes <= n.
2
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,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
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
Sequence in context: A056172 A285881 A091373 * A235492 A226762 A347697
KEYWORD
nonn
AUTHOR
Jonathan Sondow, Oct 19 2011
STATUS
approved