OFFSET
1,5
COMMENTS
Except at n=2, the largest k which must be considered is the product of the first n-1 primes, since if k includes p=prime(n) itself then q = k-p is divisible by p and so not prime.
EXAMPLE
For n=4, p = prime(4) = 7 can be written as p = 30 - 23, where 30 is a primorial and 23 is prime, but no other primorials satisfy this condition, so a(3) = 1.
MATHEMATICA
a[n_] := Count[FoldList[Times, Prime[Range[n - 1]]] - Prime[n], _?(# > 0 && PrimeQ[#] &)]; a[2] = 1; Array[a, 100] (* Amiram Eldar, Nov 14 2024 *)
PROG
(PARI) a(n)={my(p=prime(n), s=0, t=1); forprime(q=2, p, t*=q; if(t>p && isprime(t-p), s++)); s} \\ Andrew Howroyd, Nov 14 2024
CROSSREFS
KEYWORD
nonn,new
AUTHOR
Daniel D Gibson, Nov 10 2024
STATUS
approved