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.
%I A002981 M0908 #189 Jul 16 2025 13:37:56 %S A002981 0,1,2,3,11,27,37,41,73,77,116,154,320,340,399,427,872,1477,6380, %T A002981 26951,110059,150209,288465,308084,422429 %N A002981 Numbers k such that k! + 1 is prime. %C A002981 If n + 1 is prime then (by Wilson's theorem) n + 1 divides n! + 1. Thus for n > 2 if n + 1 is prime n is not in the sequence. - _Farideh Firoozbakht_, Aug 22 2003 %C A002981 For n > 2, n! + 1 is prime <==> nextprime((n+1)!) > (n+1)nextprime(n!) and we can conjecture that for n > 2 if n! + 1 is prime then (n+1)! + 1 is not prime. - Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 03 2004 %C A002981 The prime members are in A093804 (numbers n such that Sum_{d|n} d! is prime) since Sum_{d|n} d! = n! + 1 if n is prime. - _Jonathan Sondow_ %C A002981 150209 is also in the sequence, cf. the link to Caldwell's prime pages. - _M. F. Hasler_, Nov 04 2011 %D A002981 J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 116, p. 40, Ellipses, Paris 2008. %D A002981 Harvey Dubner, Factorial and primorial primes, J. Rec. Math., 19 (No. 3, 1987), 197-203. %D A002981 Richard K. Guy, Unsolved Problems in Number Theory, Section A2. %D A002981 F. Le Lionnais, Les Nombres Remarquables, Paris, Hermann, 1983, p. 100. %D A002981 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %D A002981 James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 118. %D A002981 David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 70. %H A002981 A. Borning, <a href="http://dx.doi.org/10.1090/S0025-5718-1972-0308018-5 ">Some results for k!+-1 and 2.3.5...p+-1</a>, Math. Comp., 26 (1972), 567-570. %H A002981 Chris K. Caldwell, <a href="https://t5k.org/top20/page.php?id=30">Factorial Primes</a>. %H A002981 Chris K. Caldwell, <a href="https://t5k.org/primes/page.php?id=100445">110059! + 1 on the Prime Pages</a>. %H A002981 Chris K. Caldwell, <a href="https://t5k.org/primes/page.php?id=102627">150209! + 1 on the Prime Pages</a> (Oct 31, 2011). %H A002981 Chris K. Caldwell, <a href="https://primes.utm.edu/primes/page.php?id=133139">288465! + 1 on the Prime Pages</a> (Jan 12, 2022). %H A002981 Chris K. Caldwell and Y. Gallot, <a href="http://dx.doi.org/10.1090/S0025-5718-01-01315-1">On the primality of n!+-1 and 2*3*5*...*p+-1</a>, Math. Comp., 71 (2001), 441-448. %H A002981 Antonín Čejchan, Michal Křížek, and Lawrence Somer, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL25/Krizek/krizek3.html">On Remarkable Properties of Primes Near Factorials and Primorials</a>, Journal of Integer Sequences, Vol. 25 (2022), Article 22.1.4. %H A002981 H. Dubner, <a href="/A006794/a006794.pdf">Factorial and primorial primes</a>, J. Rec. Math., 19 (No. 3, 1987), 197-203. (Annotated scanned copy) %H A002981 H. Dubner and N. J. A. Sloane, <a href="/A002981/a002981.pdf">Correspondence, 1991</a>. %H A002981 Shyam Sunder Gupta, <a href="https://doi.org/10.1007/978-981-97-2465-9_16">Fascinating Factorials</a>, Exploring the Beauty of Fascinating Numbers, Springer (2025) Ch. 16, 411-442. %H A002981 R. K. Guy and N. J. A. Sloane, <a href="/A005648/a005648.pdf">Correspondence, 1985</a>. %H A002981 N. Kuosa, <a href="https://web.archive.org/web/20031023065055/http://powersum.dnsq.org/">Source for 6380</a>. %H A002981 Des MacHale and Joseph Manning, <a href="http://dx.doi.org/10.1017/mag.2015.28">Maximal runs of strictly composite integers</a>, The Mathematical Gazette, 99, pp 213-219 (2015). %H A002981 Romeo Mestrovic, <a href="http://arxiv.org/abs/1202.3670">Euclid's theorem on the infinitude of primes: a historical survey of its proofs (300 BC--2012) and another new proof</a>, arXiv preprint arXiv:1202.3670 [math.HO], 2012. - From N. J. A. Sloane, Jun 13 2012 %H A002981 Hisanori Mishima, <a href="http://www.asahi-net.or.jp/~KC2H-MSM/mathland/matha1/matha104.htm">Factors of N!+1</a>. %H A002981 Rudolf Ondrejka, <a href="http://www.utm.edu/research/primes/lists/top_ten/">The Top Ten: a Catalogue of Primal Configurations</a>. %H A002981 Titus Piezas III, 2004. <a href="http://citeseerx.ist.psu.edu/pdf/bfba8efe17d68bc35c1a28fb79efbfefc8287ffc">Solving Solvable Sextics Using Polynomial Decomposition</a>. %H A002981 PrimePages, <a href="https://t5k.org/top20/page.php?id=30">Factorial Primes</a>. %H A002981 Maxie D. Schmidt, <a href="https://arxiv.org/abs/1701.04741">New Congruences and Finite Difference Equations for Generalized Factorial Functions</a>, arXiv:1701.04741 [math.CO], 2017. %H A002981 Apoloniusz Tyszka, <a href="https://hal.archives-ouvertes.fr/hal-01625653/document">A conjecture which implies that there are infinitely many primes of the form n!+1</a>, Preprint, 2017. %H A002981 Apoloniusz Tyszka, <a href="https://hal.archives-ouvertes.fr/hal-01614087v5/document">A common approach to the problem of the infinitude of twin primes, primes of the form n! + 1, and primes of the form n! - 1</a>, 2018. %H A002981 Apoloniusz Tyszka, <a href="https://philarchive.org/rec/TYSDAS">On sets X subset of N for which we know an algorithm that computes a threshold number t(X) in N such that X is infinite if and only if X contains an element greater than t(X)</a>, 2019. %H A002981 Apoloniusz Tyszka, <a href="https://doi.org/10.13140/RG.2.2.28996.68486">On sets X, subset of N, whose finiteness implies that we know an algorithm which for every n, element of N, decides the inequality max (X) < n</a>, (2019). %H A002981 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/FactorialPrime.html">Factorial Prime</a>. %H A002981 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/IntegerSequencePrimes.html">Integer Sequence Primes</a>. %H A002981 <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>. %e A002981 3! + 1 = 7 is prime, so 3 is in the sequence. %t A002981 v = {0, 1, 2}; Do[If[ !PrimeQ[n + 1] && PrimeQ[n! + 1], v = Append[v, n]; Print[v]], {n, 3, 29651}] %t A002981 Select[Range[100], PrimeQ[#! + 1] &] (* _Alonso del Arte_, Jul 24 2014 *) %o A002981 (PARI) for(n=0,500,if(ispseudoprime(n!+1),print1(n", "))) \\ _Charles R Greathouse IV_, Jun 16 2011 %o A002981 (Magma) [n: n in [0..800] | IsPrime(Factorial(n)+1)]; // _Vincenzo Librandi_, Oct 31 2018 %o A002981 (Python) %o A002981 from sympy import factorial, isprime %o A002981 for n in range(0,800): %o A002981 if isprime(factorial(n)+1): %o A002981 print(n, end=', ') # _Stefano Spezia_, Jan 10 2019 %Y A002981 Cf. A002982 (n!-1 is prime), A064295. A088332 gives the primes. %Y A002981 Equals A090660 - 1. %Y A002981 Cf. A093804. %K A002981 nonn,nice,hard,more %O A002981 1,3 %A A002981 _N. J. A. Sloane_ %E A002981 a(19) sent in by _Jud McCranie_, May 08 2000 %E A002981 a(20) from Ken Davis (kraden(AT)ozemail.com.au), May 24 2002 %E A002981 a(21) found by PrimeGrid around Jun 11 2011, submitted by _Eric W. Weisstein_, Jun 13 2011 %E A002981 a(22) from _Rene Dohmen_, Jun 09 2012 %E A002981 a(23) from _Rene Dohmen_, Jan 12 2022 %E A002981 a(24)-a(25) from _Dmitry Kamenetsky_, Jun 19 2024