[Math] Finitely many Supreme Primes

elementary-number-theoryprime numbers

A challenge on codegolf.stackexchange is to find the highest "supreme" prime: https://codegolf.stackexchange.com/questions/35441/find-the-largest-prime-whose-length-sum-and-product-is-prime

A supreme prime has the following properties:

  • the number itself is prime
  • the number of digits is prime
  • the sum of digits is prime
  • the product of digits is prime

Are there finitely many "supreme" primes? Are there infinitely many? Currently the highest one found is ~$10^{72227}$

Best Answer

This is not an answer, just a bit too long to be a comment. I didn't write the code for finding supreme primes, but I think it is simple.

All supreme primes $x$ are of the form:

$$x = \sum_{k=0}^n 10^k + 10^w\times(p-1) = \frac{10^{n+1} - 1}{9} + 10^w\times(p-1) \tag{1}$$

where $p$ is a prime number, and $0\le w \le n$. Therefore you only need to explore varying three parameters: $n,w,p$. Moreover, the search can be restricted so that $n + p$ (digit sum) and $n + 1$ (number of digits) are prime numbers (see comments). Defining $q = n +1$, we have to search pairs of prime numbers $p,q$ such that $p + q - 1$ is also a prime number (see comments). Having found such a pair, search for a $w$ in the range $0\le w\le q - 1$ such that $x$ in (1) is prime.

Just to clarify (there was some confusion in the comments), note that an $x$ of the form (1) may not be a supreme prime; indeed we still need to know that $x$ itself is prime.

Related Question