[Math] prime of the form $\ (9n)!+n!+1\ $

elementary-number-theoryexamples-counterexamplesnumber theoryprime numbers

See also MathOverflow: Why am I unable to find primes of the form $(9n)!+n!+1$?

In a project, I search primes of the form $$(kn)!+n!+1$$ with positive integers $\ k,n\ $. The smallest $\ k\ $ for which I still know no prime is $\ k=9\ $.

For $$k=1,2,3,4,5,6,7,8$$ the numbers $$n=1,3,605,185,850,7,11,120$$ are respective the smallest $n$ for which we get a prime, except possibly for $n = 605, 850$, in which case we just know we get a probable prime (the rest is proven to be prime according to FactorDB)

Is there a prime of the form $$(9n)!+n!+1$$ with positive integer $\ n\ $ ?

Chances should be good because such a number cannot have a prime factor less than or equal to $\ n\ $ , but upto $\ n=500\ $ , there is none.

Best Answer

Although this doesn't answer your question, it might still be helpful:

Using Mathematica (and an exhaustive amount of computing power), I have checked every number $(9n)!+n!+1$ for $n\le 2000$ with no prime found.

Finding a prime now seems very hard. For example, if we were to model a number $n$ „being prime“ as a Bernoulli random variable with parameter $\frac{1}{\ln(n)}$ [albeit motivated by the prime number theorem, this is a very rough model, for instance one could do much better already by distinguishing even and odd numbers], and if we assume the Bernoullis to be independent for $2001\le n\le 3000$ [once again very rough], then the probability of at least one success in our model is $$1-\prod_{n=2001}^{3000}\left(1-\frac{1}{\ln\left(\left(9n\right)!+n!+1\right)}\right)\approx0.00499232.$$

If you nonetheless want to continue the search for primes, here is my Mathematica code (just replace STARTHERE and STOPHERE by the lower and upper bounds of $n$ to check):

SetSharedVariable[primes, checked]; primes = {}; checked = {};
Monitor[
 ParallelDo[
  If[! PrimeQ[n + 1],
   If[PrimeQ[(9 n)! + n! + 1], AppendTo[primes, n]]
  ];
  AppendTo[checked, n],
  {n, STARTHERE, STOPHERE}, Method -> "FinestGrained"
 ],
 {Sort[checked], primes}
]

EDIT: I have updated the source code because we can skip numbers $n$ for which $n+1$ is a prime number as pointed out in the comments by Sil.

EDIT 2: Here is Python source code (sadly, the prime checking function of SymPy seems to be about ten times slower than that of Mathematica)

from multiprocessing import Pool
from os import cpu_count

from sympy.ntheory import primetest
from math import factorial

import time

START = 200
STOP  = 200

def check(n):
    num = factorial(9*n)+factorial(n)+1
    if primetest.isprime(num):
        print("Found prime for", n)
        return n

if __name__ == '__main__':
    start_time = time.time()
    with Pool(cpu_count()) as p:
        primes = p.map(check, list(range(START, STOP+1)))

    primes = [prime for prime in primes if prime]
    print("--- {} seconds ---".format(time.time() - start_time))