%I #53 Nov 02 2023 02:09:15
%S 23,29,59,61,67,71,79,83,109,137,139,149,193,227,233,239,251,257,269,
%T 271,277,293,307,311,317,359,379,383,389,397,401,419,431,449,461,463,
%U 467,479,499,503,521,557,563,569,571,577,593,599,601,607
%N Pillai primes: primes p such that there exists an integer m such that m! + 1 == 0 (mod p) and p != 1 (mod m).
%C Hardy & Subbarao prove that this sequence is infinite. An upper bound can be extracted from their proof: a(n) < e^e^...^e^O(n log n) with e appearing n times. This tetrational bound could be improved with results on the disjointness of the factorizations of numbers of the form k! + 1. - _Charles R Greathouse IV_, Sep 15 2015
%C Named after the Indian mathematician Subbayya Sivasankaranarayana Pillai (1901-1950). - _Amiram Eldar_, Jun 16 2021
%H Charles R Greathouse IV, <a href="/A063980/b063980.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)
%H G. E. Hardy and M. V. Subbarao, <a href="https://www.jstor.org/stable/2695445">A modified problem of Pillai and some related questions</a>, Amer. Math. Monthly, Vol. 109, No. 6 (2002), pp. 554-559; <a href="https://web.archive.org/web/20191210172226/http://www.math.ualberta.ca/~subbarao/documents/2002_Pillai.pdf">alternative link</a>.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Pillai_prime">Pillai prime</a>.
%t ok[p_] := (r = False; Do[If[Mod[m! + 1, p] == 0 && Mod[p, m] != 1, r = True; Break[]], {m, 2, p}]; r); Select[Prime /@ Range[111], ok] (* _Jean-François Alcover_, Apr 22 2011 *)
%t nn=1000; fact=1+Rest[FoldList[Times,1,Range[nn]]]; t={}; Do[p=Prime[i]; m=2; While[m<p && !(Mod[p,m]!=1 && Mod[fact[[m]],p]==0), m++]; If[m<p, AppendTo[t,p]], {i,2,PrimePi[nn]}]; t (* _T. D. Noe_, Apr 22 2011 *)
%o (PARI) is(p)=my(t=Mod(5040,p)); for(m=8, p-2, t*=m; if(t==-1 && p%m!=1, return(isprime(p)))); 0 \\ _Charles R Greathouse IV_, Feb 10 2013
%Y Smallest m is given in A063828, largest in A211411.
%K nonn,nice
%O 1,1
%A _R. K. Guy_, Sep 08 2001
%E More terms from _David W. Wilson_, Sep 08 2001