%I #17 Dec 07 2025 05:57:33
%S 11,23,47,167,227,251,359,479,719,1181,1847,2111,2591,3719,6719,7559,
%T 8819,10607,12539,14591,19319,27551,29231,30071,31319,51071,53819,
%U 68111,97967,149759,155219,172199,177239,195359,199799,234239,273527,305783,314711,339863,356399,379451,417311,423791
%N Primes that are (product + sum) of a sequence of consecutive primes.
%C Is 23 the only term in common with A390933, i.e. a prime that is both (product - sum) of a sequence of consecutive primes and (product + sum) of a sequence of consecutive primes?
%C No other term in common for n <= 10^8. - _Michael S. Branicky_, Dec 01 2025
%H Robert Israel, <a href="/A391078/b391078.txt">Table of n, a(n) for n = 1..10000</a>
%e a(3) = 47 is a term because 47 = 5*7 + 5 + 7 is prime, where 5 and 7 are consecutive primes.
%p N:= 1000: # for terms <= N^2
%p P:= select(isprime, [2, seq(i, i=3..N, 2)]): nP:= nops(P):
%p M:= N^2:
%p R:= {}:
%p for i from 1 to nP do
%p p:= P[i]; s:= P[i];
%p for j from i+1 to nP do
%p p:= p * P[j]; s:= s + P[j];
%p v:= p+s;
%p if v > M then break fi;
%p if isprime(v) then R:= R union {v} fi;
%p od
%p od:
%p sort(convert(R, list));
%o (Python)
%o import heapq
%o from itertools import islice
%o from sympy import isprime, sieve
%o def agen(): # generator of terms
%o pp, ss, nextcount, alst, oldv = 6, 5, 3, [], -1
%o h = [(pp+ss, pp, ss, 1, 2)]
%o while True:
%o (v, pr, sm, s, l) = heapq.heappop(h)
%o if v > oldv and isprime(v):
%o yield v
%o oldv = v
%o if v >= pp:
%o pp *= sieve[nextcount]
%o ss += sieve[nextcount]
%o heapq.heappush(h, (pp+ss, pp, ss, 1, nextcount))
%o nextcount += 1
%o pr //= sieve[s]; sm -= sieve[s]; s += 1; l += 1; pr *= sieve[l]; sm += sieve[l]
%o heapq.heappush(h, (pr+sm, pr, sm, s, l))
%o return alst
%o print(list(islice(agen(), 44))) # _Michael S. Branicky_, Nov 30 2025
%Y Cf. A387590, A390933.
%K nonn
%O 1,1
%A _Will Gosnell_ and _Robert Israel_, Nov 27 2025