OFFSET
1,1
LINKS
Mathematics Stack Exchange, Finding least positive integer k>1 such that there exactly exists 100 primes with the form m!-k, 2024.
EXAMPLE
a(4) = 11 because there exist exactly 4 integers k {4, 5, 6, 10} such that k! - 11 is a positive prime, and there is no prime p < 11 for which there are exactly 4 integers k such that k! - p is a positive prime.
MATHEMATICA
t[n_] :=
Module[{m = 0, s = {}},
For[k = 3, k <= n, k++, If[k! > n && PrimeQ[k! - n],
AppendTo[s, k]; m++]]; {m, n, s}];
b = Table[t[p], {p, Prime@Range@50}]; Table[SelectFirst[b, #[[1]] == n &][[2]], {n, 15}]
PROG
(PARI) isok(p, n) = vecsum(vector(p-1, k, ispseudoprime(k!-p))) == n;
a(n) = my(p=2); while (!isok(p, n), p = nextprime(p+1)); p; \\ Michel Marcus, Jul 02 2024
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Zhining Yang, Jun 12 2024
STATUS
approved