OFFSET
1,1
COMMENTS
n=1: {3}# - 3 is a prime.
n=2: {5,7}# - 11 are primes.
n=3: {5,7,11}# - 13 are primes.
n=4: {5,7,11,13}# - 17 are primes.
n=5: {7,13,17,19,41}# - 47 are primes.
n=6: {7,23,29,67,79,89}# - 101 are primes.
n=7: {11,31,41,43,53,61,83}# - 89 are primes.
n=8: {7,11,19,23,31,47,73,89}# - 97 are primes.
n=9: {7,17,19,23,31,53,67,71,79}# - 127 are primes.
n=10: {11,19,23,31,37,113,163,167,229,419}# - 439 are primes.
a(30)=27583 because for n=30, {13,19,31,53,61,79,101,103,137,149,157,367,383,433,499,577,701,733,2083,2467,3041,4357,6793,7243,7717,9769,11789,13331,18661,25561}# - 27583 are primes.
EXAMPLE
a(5) = 47 because there exist exactly 5 primes q {7,13,17,19,41} such that q# - 47 is a positive prime, and there is no prime p < 47 for which there are exactly 5 primes q such that q# - p is a positive prime.
MATHEMATICA
v = FoldList[Times, Prime[Range[100]]];
t[n_] :=
Module[{m = 0, s = {}},
For[k = 1, k <= n, k++, w = v[[k]] - Prime@n;
If[w > 0 && PrimeQ[w], m++;
AppendTo[s, Prime@k]]; ]; {m, Prime@n, s}];
b = Table[t[p], {p, 100}];
Table[SelectFirst[b, #[[1]] == n &][[2]], {n, 12}]
PROG
(PARI) pp(k) = vecprod(primes([1, prime(k)]));
isok(p, n) = vecsum(vector(p-1, k, ispseudoprime(pp(k)-p))) == n;
a(n) = my(p=2); while (!isok(p, n), p = nextprime(p+1)); p; \\ Michel Marcus, Jul 03 2024
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Zhining Yang, Jun 15 2024
STATUS
approved