login
A377887
a(n) is the number of ways of writing prime(n) as k-q with q a prime and k a primorial.
0
0, 1, 0, 1, 2, 3, 4, 3, 3, 3, 1, 3, 4, 4, 5, 4, 5, 3, 4, 4, 5, 4, 4, 7, 8, 6, 5, 7, 4, 5, 9, 5, 6, 5, 9, 7, 4, 5, 8, 5, 8, 6, 7, 5, 9, 6, 5, 7, 6, 4, 3, 9, 6, 5, 12, 8, 5, 6, 7, 7, 6, 9, 8, 7, 13, 4, 8, 4, 6, 6, 7, 4, 7, 11, 5, 8, 8, 9, 6, 7, 7, 6, 12, 4, 10, 11, 11, 7, 8, 11
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
Sequence in context: A101497 A274007 A065870 * A123699 A322808 A352899
KEYWORD
nonn
AUTHOR
Daniel D Gibson, Nov 10 2024
STATUS
approved